mirror of
https://github.com/nushell/nushell.git
synced 2025-06-21 02:18:44 +02:00
lint/fmt fixes
This commit is contained in:
parent
57ade6fcd6
commit
9ebb5c3385
@ -31,8 +31,7 @@ impl Command for FormatPattern {
|
|||||||
fn description(&self) -> &str {
|
fn description(&self) -> &str {
|
||||||
r"Format values into a string using either a simple pattern or `printf`-compatible pattern.
|
r"Format values into a string using either a simple pattern or `printf`-compatible pattern.
|
||||||
Simple pattern supports input of type list<any>, table, and record;
|
Simple pattern supports input of type list<any>, table, and record;
|
||||||
`printf` pattern supports input types that are coercible to string, namely bool, int, float, string, glob, binary and date, and also list of a mix of those types.
|
`printf` pattern supports input types that are coercible to string, namely bool, int, float, string, glob, binary and date, and also list of a mix of those types."
|
||||||
"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
fn run(
|
||||||
@ -289,9 +288,8 @@ fn assert_specifier_count_eq_arg_count(
|
|||||||
msg: format!(
|
msg: format!(
|
||||||
"Number of arguments ({}) provided does not match the number of specifiers ({}) given in the pattern.",
|
"Number of arguments ({}) provided does not match the number of specifiers ({}) given in the pattern.",
|
||||||
arg_count, spec_count,
|
arg_count, spec_count,
|
||||||
)
|
),
|
||||||
.into(),
|
span,
|
||||||
span: span,
|
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
Ok(())
|
Ok(())
|
||||||
@ -320,7 +318,7 @@ fn format_printf(
|
|||||||
.map(Value::coerce_into_string)
|
.map(Value::coerce_into_string)
|
||||||
.collect::<Result<Vec<_>, _>>()?
|
.collect::<Result<Vec<_>, _>>()?
|
||||||
}
|
}
|
||||||
v @ Value::Nothing {..} => {
|
v @ Value::Nothing { .. } => {
|
||||||
assert_specifier_count_eq_arg_count(spec_count, 0, v.span())?;
|
assert_specifier_count_eq_arg_count(spec_count, 0, v.span())?;
|
||||||
vec![]
|
vec![]
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user