Skip to content

Commit c2d4266

Browse files
committed
Auto merge of #9525 - nyurik:apply-lints, r=llogiq
pre-fallout: Apply uninlined_format-args lint This change is needed for the uninlined_format-args lint to be merged. See #9233 changelog: none
2 parents ff65eec + 59d0e8c commit c2d4266

File tree

241 files changed

+623
-917
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

241 files changed

+623
-917
lines changed

clippy_dev/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ fn main() {
4141
matches.contains_id("msrv"),
4242
) {
4343
Ok(_) => update_lints::update(update_lints::UpdateMode::Change),
44-
Err(e) => eprintln!("Unable to create lint: {}", e),
44+
Err(e) => eprintln!("Unable to create lint: {e}"),
4545
}
4646
},
4747
Some(("setup", sub_command)) => match sub_command.subcommand() {

clippy_lints/src/approx_const.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ impl ApproxConstant {
9292
cx,
9393
APPROX_CONSTANT,
9494
e.span,
95-
&format!("approximate value of `{}::consts::{}` found", module, &name),
95+
&format!("approximate value of `{module}::consts::{}` found", &name),
9696
None,
9797
"consider using the constant directly",
9898
);
@@ -126,7 +126,7 @@ fn is_approx_const(constant: f64, value: &str, min_digits: usize) -> bool {
126126
// The value is a truncated constant
127127
true
128128
} else {
129-
let round_const = format!("{:.*}", value.len() - 2, constant);
129+
let round_const = format!("{constant:.*}", value.len() - 2);
130130
value == round_const
131131
}
132132
}

clippy_lints/src/asm_syntax.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ fn check_expr_asm_syntax(lint: &'static Lint, cx: &EarlyContext<'_>, expr: &Expr
4444
cx,
4545
lint,
4646
expr.span,
47-
&format!("{} x86 assembly syntax used", style),
47+
&format!("{style} x86 assembly syntax used"),
4848
None,
4949
&format!("use {} x86 assembly syntax", !style),
5050
);

clippy_lints/src/assertions_on_constants.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ impl<'tcx> LateLintPass<'tcx> for AssertionsOnConstants {
6060
cx,
6161
ASSERTIONS_ON_CONSTANTS,
6262
macro_call.span,
63-
&format!("`assert!(false{})` should probably be replaced", assert_arg),
63+
&format!("`assert!(false{assert_arg})` should probably be replaced"),
6464
None,
65-
&format!("use `panic!({})` or `unreachable!({0})`", panic_arg),
65+
&format!("use `panic!({panic_arg})` or `unreachable!({panic_arg})`"),
6666
);
6767
}
6868
}

clippy_lints/src/assertions_on_result_states.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,8 @@ impl<'tcx> LateLintPass<'tcx> for AssertionsOnResultStates {
6969
"called `assert!` with `Result::is_ok`",
7070
"replace with",
7171
format!(
72-
"{}.unwrap(){}",
73-
snippet_with_context(cx, recv.span, condition.span.ctxt(), "..", &mut app).0,
74-
semicolon
72+
"{}.unwrap(){semicolon}",
73+
snippet_with_context(cx, recv.span, condition.span.ctxt(), "..", &mut app).0
7574
),
7675
app,
7776
);
@@ -84,9 +83,8 @@ impl<'tcx> LateLintPass<'tcx> for AssertionsOnResultStates {
8483
"called `assert!` with `Result::is_err`",
8584
"replace with",
8685
format!(
87-
"{}.unwrap_err(){}",
88-
snippet_with_context(cx, recv.span, condition.span.ctxt(), "..", &mut app).0,
89-
semicolon
86+
"{}.unwrap_err(){semicolon}",
87+
snippet_with_context(cx, recv.span, condition.span.ctxt(), "..", &mut app).0
9088
),
9189
app,
9290
);

clippy_lints/src/attrs.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -541,10 +541,7 @@ fn check_attrs(cx: &LateContext<'_>, span: Span, name: Symbol, attrs: &[Attribut
541541
cx,
542542
INLINE_ALWAYS,
543543
attr.span,
544-
&format!(
545-
"you have declared `#[inline(always)]` on `{}`. This is usually a bad idea",
546-
name
547-
),
544+
&format!("you have declared `#[inline(always)]` on `{name}`. This is usually a bad idea"),
548545
);
549546
}
550547
}
@@ -720,7 +717,7 @@ fn check_mismatched_target_os(cx: &EarlyContext<'_>, attr: &Attribute) {
720717
let mut unix_suggested = false;
721718

722719
for (os, span) in mismatched {
723-
let sugg = format!("target_os = \"{}\"", os);
720+
let sugg = format!("target_os = \"{os}\"");
724721
diag.span_suggestion(span, "try", sugg, Applicability::MaybeIncorrect);
725722

726723
if !unix_suggested && is_unix(os) {

clippy_lints/src/bool_assert_comparison.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,9 @@ impl<'tcx> LateLintPass<'tcx> for BoolAssertComparison {
9898
cx,
9999
BOOL_ASSERT_COMPARISON,
100100
macro_call.span,
101-
&format!("used `{}!` with a literal bool", macro_name),
101+
&format!("used `{macro_name}!` with a literal bool"),
102102
"replace it with",
103-
format!("{}!(..)", non_eq_mac),
103+
format!("{non_eq_mac}!(..)"),
104104
Applicability::MaybeIncorrect,
105105
);
106106
}

clippy_lints/src/booleans.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -263,9 +263,8 @@ fn simplify_not(cx: &LateContext<'_>, expr: &Expr<'_>) -> Option<String> {
263263
}
264264
.and_then(|op| {
265265
Some(format!(
266-
"{}{}{}",
266+
"{}{op}{}",
267267
snippet_opt(cx, lhs.span)?,
268-
op,
269268
snippet_opt(cx, rhs.span)?
270269
))
271270
})
@@ -285,7 +284,7 @@ fn simplify_not(cx: &LateContext<'_>, expr: &Expr<'_>) -> Option<String> {
285284
let path: &str = path.ident.name.as_str();
286285
a == path
287286
})
288-
.and_then(|(_, neg_method)| Some(format!("{}.{}()", snippet_opt(cx, receiver.span)?, neg_method)))
287+
.and_then(|(_, neg_method)| Some(format!("{}.{neg_method}()", snippet_opt(cx, receiver.span)?)))
289288
},
290289
_ => None,
291290
}

clippy_lints/src/cargo/common_metadata.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ pub(super) fn check(cx: &LateContext<'_>, metadata: &Metadata, ignore_publish: b
4040
}
4141

4242
fn missing_warning(cx: &LateContext<'_>, package: &cargo_metadata::Package, field: &str) {
43-
let message = format!("package `{}` is missing `{}` metadata", package.name, field);
43+
let message = format!("package `{}` is missing `{field}` metadata", package.name);
4444
span_lint(cx, CARGO_COMMON_METADATA, DUMMY_SP, &message);
4545
}
4646

clippy_lints/src/cargo/feature_name.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,8 @@ fn lint(cx: &LateContext<'_>, feature: &str, substring: &str, is_prefix: bool) {
5757
},
5858
DUMMY_SP,
5959
&format!(
60-
"the \"{}\" {} in the feature name \"{}\" is {}",
61-
substring,
60+
"the \"{substring}\" {} in the feature name \"{feature}\" is {}",
6261
if is_prefix { "prefix" } else { "suffix" },
63-
feature,
6462
if is_negative { "negative" } else { "redundant" }
6563
),
6664
None,

0 commit comments

Comments
 (0)