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:
Stefan Holderbach
2023-01-30 02:37:54 +01:00
committed by GitHub
parent 6ae497eedc
commit ab480856a5
134 changed files with 386 additions and 431 deletions

View File

@@ -478,7 +478,7 @@ impl EngineState {
|| file_name.contains('"')
|| file_name.contains(' ')
{
file_name = format!("`{}`", file_name);
file_name = format!("`{file_name}`");
}
serde_json::to_string_pretty(&decl.signature())
@@ -499,7 +499,7 @@ impl EngineState {
// Each signature is stored in the plugin file with the shell and signature
// This information will be used when loading the plugin
// information when nushell starts
format!("register {} {} {}\n\n", file_name, shell_str, signature)
format!("register {file_name} {shell_str} {signature}\n\n")
})
.map_err(|err| ShellError::PluginFailedToLoad(err.to_string()))
.and_then(|line| {
@@ -511,7 +511,7 @@ impl EngineState {
plugin_file.flush().map_err(|err| {
ShellError::GenericError(
"Error flushing plugin file".to_string(),
format! {"{}", err},
format! {"{err}"},
None,
None,
Vec::new(),
@@ -567,7 +567,7 @@ impl EngineState {
pub fn print_contents(&self) {
for (contents, _, _) in self.file_contents.iter() {
let string = String::from_utf8_lossy(contents);
println!("{}", string);
println!("{string}");
}
}