mirror of
https://github.com/nushell/nushell.git
synced 2025-08-18 20:58:41 +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
@@ -239,7 +239,7 @@ fn create_grid_output(
|
||||
Value::string(grid_display.to_string(), call.head)
|
||||
} else {
|
||||
Value::String {
|
||||
val: format!("Couldn't fit grid into {} columns!", cols),
|
||||
val: format!("Couldn't fit grid into {cols} columns!"),
|
||||
span: call.head,
|
||||
}
|
||||
}
|
||||
|
@@ -320,7 +320,7 @@ fn handle_table_command(
|
||||
} else {
|
||||
// assume this failed because the table was too wide
|
||||
// TODO: more robust error classification
|
||||
format!("Couldn't fit table into {} columns!", term_width)
|
||||
format!("Couldn't fit table into {term_width} columns!")
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1481,7 +1481,7 @@ fn convert_with_precision(val: &str, precision: usize) -> Result<String, ShellEr
|
||||
));
|
||||
}
|
||||
};
|
||||
Ok(format!("{:.prec$}", val_float, prec = precision))
|
||||
Ok(format!("{val_float:.precision$}"))
|
||||
}
|
||||
|
||||
fn is_cfg_trim_keep_words(config: &Config) -> bool {
|
||||
@@ -1696,7 +1696,7 @@ impl Iterator for PagingTableCreator {
|
||||
// assume this failed because the table was too wide
|
||||
// TODO: more robust error classification
|
||||
let term_width = get_width_param(self.width_param);
|
||||
format!("Couldn't fit table into {} columns!", term_width)
|
||||
format!("Couldn't fit table into {term_width} columns!")
|
||||
};
|
||||
Some(Ok(msg.as_bytes().to_vec()))
|
||||
}
|
||||
|
Reference in New Issue
Block a user