mirror of
https://github.com/nushell/nushell.git
synced 2025-08-10 09:28:19 +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
@ -682,13 +682,13 @@ Format: #
|
||||
}
|
||||
|
||||
let output = if escape && param_is_valid_string {
|
||||
format!("\x1b[{}", code_string)
|
||||
format!("\x1b[{code_string}")
|
||||
} else if osc && param_is_valid_string {
|
||||
// Operating system command aka osc ESC ] <- note the right brace, not left brace for osc
|
||||
// OCS's need to end with either:
|
||||
// bel '\x07' char
|
||||
// string terminator aka st '\\' char
|
||||
format!("\x1b]{}", code_string)
|
||||
format!("\x1b]{code_string}")
|
||||
} else if param_is_valid_string {
|
||||
// parse hex colors like #00FF00
|
||||
if code_string.starts_with('#') {
|
||||
@ -700,7 +700,7 @@ Format: #
|
||||
Err(err) => {
|
||||
return Err(ShellError::GenericError(
|
||||
"error parsing hex color".to_string(),
|
||||
format!("{}", err),
|
||||
format!("{err}"),
|
||||
Some(code.span()?),
|
||||
None,
|
||||
Vec::new(),
|
||||
@ -738,7 +738,7 @@ Format: #
|
||||
"attr" => nu_style.attr = Some(v.as_string()?),
|
||||
_ => {
|
||||
return Err(ShellError::IncompatibleParametersSingle(
|
||||
format!("problem with key: {}", k),
|
||||
format!("problem with key: {k}"),
|
||||
code.expect_span(),
|
||||
))
|
||||
}
|
||||
|
@ -146,7 +146,7 @@ fn process_value(value: &Value, text: &Option<String>, command_span: &Span) -> V
|
||||
}
|
||||
|
||||
fn add_osc_link(text: &str, link: &str) -> String {
|
||||
format!("\u{1b}]8;;{}\u{1b}\\{}\u{1b}]8;;\u{1b}\\", link, text)
|
||||
format!("\u{1b}]8;;{link}\u{1b}\\{text}\u{1b}]8;;\u{1b}\\")
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
Reference in New Issue
Block a user