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

@ -237,7 +237,7 @@ pub fn check_name<'a>(
Some((
&spans[command_len],
ParseError::AssignmentMismatch(
format!("{} missing name", name),
format!("{name} missing name"),
"missing name".into(),
spans[command_len],
),
@ -251,7 +251,7 @@ pub fn check_name<'a>(
Some((
&spans[command_len + 1],
ParseError::AssignmentMismatch(
format!("{} missing sign", name),
format!("{name} missing sign"),
"missing equal sign".into(),
spans[command_len + 1],
),
@ -673,7 +673,7 @@ pub fn parse_multispan_value(
(
Expression::garbage(span),
Some(ParseError::Expected(
format!("one of a list of accepted shapes: {:?}", shapes),
format!("one of a list of accepted shapes: {shapes:?}"),
span,
)),
)
@ -3668,7 +3668,7 @@ pub fn parse_signature_helper(
error = error.or_else(|| {
Some(ParseError::AssignmentMismatch(
"Default value wrong type".into(),
format!("default value not {}", t),
format!("default value not {t}"),
expression.span,
))
})
@ -3717,8 +3717,7 @@ pub fn parse_signature_helper(
"Default value is the wrong type"
.into(),
format!(
"default value should be {}",
t
"default value should be {t}"
),
expression_span,
))
@ -4428,7 +4427,7 @@ pub fn parse_value(
return (
Expression::garbage(span),
Some(ParseError::Expected(
format!("non-block value: {}", shape),
format!("non-block value: {shape}"),
span,
)),
);