mirror of
https://github.com/nushell/nushell.git
synced 2025-08-19 07:41:30 +02:00
Use variable names directly in the format strings (#7906)
# Description Lint: `clippy::uninlined_format_args` More readable in most situations. (May be slightly confusing for modifier format strings https://doc.rust-lang.org/std/fmt/index.html#formatting-parameters) Alternative to #7865 # User-Facing Changes None intended # Tests + Formatting (Ran `cargo +stable clippy --fix --workspace -- -A clippy::all -D clippy::uninlined_format_args` to achieve this. Depends on Rust `1.67`)
This commit is contained in:
committed by
GitHub
parent
6ae497eedc
commit
ab480856a5
@@ -232,7 +232,7 @@ fn action(input: &Value, args: &Arguments, head: Span) -> Value {
|
||||
return Value::Error {
|
||||
error: ShellError::UnsupportedInput(
|
||||
"timestamp is out of range; it should between -8e+12 and 8e+12".to_string(),
|
||||
format!("timestamp is {:?}", ts),
|
||||
format!("timestamp is {ts:?}"),
|
||||
head,
|
||||
// Again, can safely unwrap this from here on
|
||||
input.expect_span(),
|
||||
|
@@ -367,8 +367,7 @@ fn int_from_string(a_string: &str, span: Span) -> Result<i64, ShellError> {
|
||||
"string".to_string(),
|
||||
span,
|
||||
Some(format!(
|
||||
r#"string "{}" does not represent a valid integer"#,
|
||||
trimmed
|
||||
r#"string "{trimmed}" does not represent a valid integer"#
|
||||
)),
|
||||
)),
|
||||
},
|
||||
|
@@ -206,7 +206,7 @@ fn action(input: &Value, args: &Arguments, span: Span) -> Value {
|
||||
if decimals {
|
||||
let decimal_value = digits.unwrap_or(2) as usize;
|
||||
Value::String {
|
||||
val: format!("{:.*}", decimal_value, val),
|
||||
val: format!("{val:.decimal_value$}"),
|
||||
span,
|
||||
}
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user