mirror of
https://github.com/nushell/nushell.git
synced 2025-06-30 22:50:14 +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
@ -55,7 +55,7 @@ pub fn value_to_string(v: &Value, span: Span) -> Result<String, ShellError> {
|
||||
Value::Binary { val, .. } => {
|
||||
let mut s = String::with_capacity(2 * val.len());
|
||||
for byte in val {
|
||||
if write!(s, "{:02X}", byte).is_err() {
|
||||
if write!(s, "{byte:02X}").is_err() {
|
||||
return Err(ShellError::UnsupportedInput(
|
||||
"could not convert binary to string".into(),
|
||||
"value originates from here".into(),
|
||||
@ -64,7 +64,7 @@ pub fn value_to_string(v: &Value, span: Span) -> Result<String, ShellError> {
|
||||
));
|
||||
}
|
||||
}
|
||||
Ok(format!("0x[{}]", s))
|
||||
Ok(format!("0x[{s}]"))
|
||||
}
|
||||
Value::Block { .. } => Err(ShellError::UnsupportedInput(
|
||||
"blocks are currently not nuon-compatible".into(),
|
||||
@ -125,7 +125,7 @@ pub fn value_to_string(v: &Value, span: Span) -> Result<String, ShellError> {
|
||||
.iter()
|
||||
.map(|string| {
|
||||
if needs_quotes(string) {
|
||||
format!("\"{}\"", string)
|
||||
format!("\"{string}\"")
|
||||
} else {
|
||||
string.to_string()
|
||||
}
|
||||
|
@ -143,13 +143,13 @@ fn local_into_string(value: Value, separator: &str, config: &Config) -> String {
|
||||
.join(separator),
|
||||
Value::LazyRecord { val, .. } => match val.collect() {
|
||||
Ok(val) => local_into_string(val, separator, config),
|
||||
Err(error) => format!("{:?}", error),
|
||||
Err(error) => format!("{error:?}"),
|
||||
},
|
||||
Value::Block { val, .. } => format!("<Block {}>", val),
|
||||
Value::Closure { val, .. } => format!("<Closure {}>", val),
|
||||
Value::Block { val, .. } => format!("<Block {val}>"),
|
||||
Value::Closure { val, .. } => format!("<Closure {val}>"),
|
||||
Value::Nothing { .. } => String::new(),
|
||||
Value::Error { error } => format!("{:?}", error),
|
||||
Value::Binary { val, .. } => format!("{:?}", val),
|
||||
Value::Error { error } => format!("{error:?}"),
|
||||
Value::Binary { val, .. } => format!("{val:?}"),
|
||||
Value::CellPath { val, .. } => val.into_string(),
|
||||
Value::CustomValue { val, .. } => val.value_string(),
|
||||
}
|
||||
|
Reference in New Issue
Block a user