Skip to content

Commit 5bebbf3

Browse files
committed
fix fallout from previous commit
1 parent 6bedaae commit 5bebbf3

File tree

233 files changed

+372
-370
lines changed

Some content is hidden

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

233 files changed

+372
-370
lines changed

clippy_lints/src/approx_const.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ impl ApproxConstant {
9595
cx,
9696
APPROX_CONSTANT,
9797
e.span,
98-
&format!("approximate value of `{module}::consts::{}` found", &name),
98+
format!("approximate value of `{module}::consts::{}` found", &name),
9999
None,
100100
"consider using the constant directly",
101101
);

clippy_lints/src/asm_syntax.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ fn check_asm_syntax(
5353
cx,
5454
lint,
5555
span,
56-
&format!("{style} x86 assembly syntax used"),
56+
format!("{style} x86 assembly syntax used"),
5757
None,
58-
&format!("use {} x86 assembly syntax", !style),
58+
format!("use {} x86 assembly syntax", !style),
5959
);
6060
}
6161
}

clippy_lints/src/assertions_on_constants.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ impl<'tcx> LateLintPass<'tcx> for AssertionsOnConstants {
5858
cx,
5959
ASSERTIONS_ON_CONSTANTS,
6060
macro_call.span,
61-
&format!(
61+
format!(
6262
"`{}!(true)` will be optimized out by the compiler",
6363
cx.tcx.item_name(macro_call.def_id)
6464
),
@@ -74,9 +74,9 @@ impl<'tcx> LateLintPass<'tcx> for AssertionsOnConstants {
7474
cx,
7575
ASSERTIONS_ON_CONSTANTS,
7676
macro_call.span,
77-
&format!("`assert!(false{assert_arg})` should probably be replaced"),
77+
format!("`assert!(false{assert_arg})` should probably be replaced"),
7878
None,
79-
&format!("use `panic!({panic_arg})` or `unreachable!({panic_arg})`"),
79+
format!("use `panic!({panic_arg})` or `unreachable!({panic_arg})`"),
8080
);
8181
}
8282
}

clippy_lints/src/attrs/allow_attributes_without_reason.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ pub(super) fn check<'cx>(cx: &LateContext<'cx>, name: Symbol, items: &[NestedMet
3030
cx,
3131
ALLOW_ATTRIBUTES_WITHOUT_REASON,
3232
attr.span,
33-
&format!("`{}` attribute without specifying a reason", name.as_str()),
33+
format!("`{}` attribute without specifying a reason", name.as_str()),
3434
None,
3535
"try adding a reason at the end with `, reason = \"..\"`",
3636
);

clippy_lints/src/attrs/inline_always.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pub(super) fn check(cx: &LateContext<'_>, span: Span, name: Symbol, attrs: &[Att
2121
cx,
2222
INLINE_ALWAYS,
2323
attr.span,
24-
&format!("you have declared `#[inline(always)]` on `{name}`. This is usually a bad idea"),
24+
format!("you have declared `#[inline(always)]` on `{name}`. This is usually a bad idea"),
2525
);
2626
}
2727
}

clippy_lints/src/attrs/maybe_misused_cfg.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ fn check_nested_misused_cfg(cx: &EarlyContext<'_>, items: &[NestedMetaItem]) {
4040
cx,
4141
MAYBE_MISUSED_CFG,
4242
meta.span,
43-
&format!("'test' may be misspelled as '{}'", ident.name.as_str()),
43+
format!("'test' may be misspelled as '{}'", ident.name.as_str()),
4444
"did you mean",
4545
"test".to_string(),
4646
Applicability::MaybeIncorrect,

clippy_lints/src/attrs/unnecessary_clippy_cfg.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ pub(super) fn check(
5858
clippy_lints,
5959
"no need to put clippy lints behind a `clippy` cfg",
6060
None,
61-
&format!(
61+
format!(
6262
"write instead: `#{}[{}({})]`",
6363
if attr.style == AttrStyle::Inner { "!" } else { "" },
6464
ident.name,

clippy_lints/src/await_holding_invalid.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ fn emit_invalid_type(cx: &LateContext<'_>, span: Span, disallowed: &DisallowedPa
267267
cx,
268268
AWAIT_HOLDING_INVALID_TYPE,
269269
span,
270-
&format!(
270+
format!(
271271
"`{}` may not be held across an `await` point per `clippy.toml`",
272272
disallowed.path()
273273
),

clippy_lints/src/blocks_in_conditions.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ impl<'tcx> LateLintPass<'tcx> for BlocksInConditions {
7272
else {
7373
return;
7474
};
75-
let complex_block_message = &format!(
75+
let complex_block_message = format!(
7676
"in {desc}, avoid complex blocks or closures with blocks; \
7777
instead, move the block or closure higher and bind it with a `let`",
7878
);
@@ -141,7 +141,7 @@ impl<'tcx> LateLintPass<'tcx> for BlocksInConditions {
141141
let ex = &body.value;
142142
if let ExprKind::Block(block, _) = ex.kind {
143143
if !body.value.span.from_expansion() && !block.stmts.is_empty() {
144-
span_lint(cx, BLOCKS_IN_CONDITIONS, ex.span, complex_block_message);
144+
span_lint(cx, BLOCKS_IN_CONDITIONS, ex.span, complex_block_message.clone());
145145
return ControlFlow::Continue(Descend::No);
146146
}
147147
}

clippy_lints/src/bool_assert_comparison.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ impl<'tcx> LateLintPass<'tcx> for BoolAssertComparison {
121121
cx,
122122
BOOL_ASSERT_COMPARISON,
123123
macro_call.span,
124-
&format!("used `{macro_name}!` with a literal bool"),
124+
format!("used `{macro_name}!` with a literal bool"),
125125
|diag| {
126126
// assert_eq!(...)
127127
// ^^^^^^^^^

clippy_lints/src/cargo/common_metadata.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ pub(super) fn check(cx: &LateContext<'_>, metadata: &Metadata, ignore_publish: b
4141

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

4747
fn is_empty_str<T: AsRef<std::ffi::OsStr>>(value: &Option<T>) -> bool {

clippy_lints/src/cargo/feature_name.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,13 @@ fn lint(cx: &LateContext<'_>, feature: &str, substring: &str, is_prefix: bool) {
5656
REDUNDANT_FEATURE_NAMES
5757
},
5858
DUMMY_SP,
59-
&format!(
59+
format!(
6060
"the \"{substring}\" {} in the feature name \"{feature}\" is {}",
6161
if is_prefix { "prefix" } else { "suffix" },
6262
if is_negative { "negative" } else { "redundant" }
6363
),
6464
None,
65-
&format!(
65+
format!(
6666
"consider renaming the feature to \"{}\"{}",
6767
if is_prefix {
6868
feature.strip_prefix(substring)

clippy_lints/src/cargo/lint_groups_priority.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ fn check_table(cx: &LateContext<'_>, table: LintTable, groups: &FxHashSet<&str>,
102102
cx,
103103
LINT_GROUPS_PRIORITY,
104104
toml_span(group.span(), file),
105-
&format!(
105+
format!(
106106
"lint group `{}` has the same priority ({priority}) as a lint",
107107
group.as_ref()
108108
),

clippy_lints/src/cargo/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ impl LateLintPass<'_> for Cargo {
241241
},
242242
Err(e) => {
243243
for lint in NO_DEPS_LINTS {
244-
span_lint(cx, lint, DUMMY_SP, &format!("could not read cargo metadata: {e}"));
244+
span_lint(cx, lint, DUMMY_SP, format!("could not read cargo metadata: {e}"));
245245
}
246246
},
247247
}
@@ -257,7 +257,7 @@ impl LateLintPass<'_> for Cargo {
257257
},
258258
Err(e) => {
259259
for lint in WITH_DEPS_LINTS {
260-
span_lint(cx, lint, DUMMY_SP, &format!("could not read cargo metadata: {e}"));
260+
span_lint(cx, lint, DUMMY_SP, format!("could not read cargo metadata: {e}"));
261261
}
262262
},
263263
}

clippy_lints/src/cargo/multiple_crate_versions.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ pub(super) fn check(cx: &LateContext<'_>, metadata: &Metadata, allowed_duplicate
5252
cx,
5353
MULTIPLE_CRATE_VERSIONS,
5454
DUMMY_SP,
55-
&format!("multiple versions for dependency `{name}`: {versions}"),
55+
format!("multiple versions for dependency `{name}`: {versions}"),
5656
);
5757
}
5858
}

clippy_lints/src/cargo/wildcard_dependencies.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pub(super) fn check(cx: &LateContext<'_>, metadata: &Metadata) {
1717
cx,
1818
WILDCARD_DEPENDENCIES,
1919
DUMMY_SP,
20-
&format!("wildcard dependency for `{}`", dep.name),
20+
format!("wildcard dependency for `{}`", dep.name),
2121
);
2222
}
2323
}

clippy_lints/src/casts/as_ptr_cast_mut.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ pub(super) fn check(cx: &LateContext<'_>, expr: &Expr<'_>, cast_expr: &Expr<'_>,
3333
cx,
3434
AS_PTR_CAST_MUT,
3535
expr.span,
36-
&format!("casting the result of `as_ptr` to *mut {ptrty}"),
36+
format!("casting the result of `as_ptr` to *mut {ptrty}"),
3737
"replace with",
3838
format!("{recv}.as_mut_ptr()"),
3939
applicability,

clippy_lints/src/casts/cast_abs_to_unsigned.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ pub(super) fn check(
3434
cx,
3535
CAST_ABS_TO_UNSIGNED,
3636
span,
37-
&format!("casting the result of `{cast_from}::abs()` to {cast_to}"),
37+
format!("casting the result of `{cast_from}::abs()` to {cast_to}"),
3838
"replace with",
3939
format!("{}.unsigned_abs()", Sugg::hir(cx, receiver, "..").maybe_par()),
4040
Applicability::MachineApplicable,

clippy_lints/src/casts/cast_lossless.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ pub(super) fn check(
6868
cx,
6969
CAST_LOSSLESS,
7070
expr.span,
71-
&message,
71+
message,
7272
"try",
7373
format!("{cast_to_fmt}::from({sugg})"),
7474
app,

clippy_lints/src/casts/cast_nan_to_int.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ pub(super) fn check(cx: &LateContext<'_>, expr: &Expr<'_>, cast_expr: &Expr<'_>,
1212
cx,
1313
CAST_NAN_TO_INT,
1414
expr.span,
15-
&format!("casting a known NaN to {to_ty}"),
15+
format!("casting a known NaN to {to_ty}"),
1616
None,
1717
"this always evaluates to 0",
1818
);

clippy_lints/src/casts/cast_possible_truncation.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ pub(super) fn check(
142142
cx,
143143
CAST_ENUM_TRUNCATION,
144144
expr.span,
145-
&format!(
145+
format!(
146146
"casting `{cast_from}::{}` to `{cast_to}` will truncate the value{suffix}",
147147
variant.name,
148148
),
@@ -163,7 +163,7 @@ pub(super) fn check(
163163
_ => return,
164164
};
165165

166-
span_lint_and_then(cx, CAST_POSSIBLE_TRUNCATION, expr.span, &msg, |diag| {
166+
span_lint_and_then(cx, CAST_POSSIBLE_TRUNCATION, expr.span, msg, |diag| {
167167
diag.help("if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...");
168168
if !cast_from.is_floating_point() {
169169
offer_suggestion(cx, expr, cast_expr, cast_to_span, diag);

clippy_lints/src/casts/cast_possible_wrap.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ pub(super) fn check(cx: &LateContext<'_>, expr: &Expr<'_>, cast_from: Ty<'_>, ca
7979
),
8080
};
8181

82-
span_lint_and_then(cx, CAST_POSSIBLE_WRAP, expr.span, &message, |diag| {
82+
span_lint_and_then(cx, CAST_POSSIBLE_WRAP, expr.span, message, |diag| {
8383
if let EmitState::LintOnPtrSize(16) = should_lint {
8484
diag
8585
.note("`usize` and `isize` may be as small as 16 bits on some platforms")

clippy_lints/src/casts/cast_precision_loss.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ pub(super) fn check(cx: &LateContext<'_>, expr: &Expr<'_>, cast_from: Ty<'_>, ca
3838
cx,
3939
CAST_PRECISION_LOSS,
4040
expr.span,
41-
&format!(
41+
format!(
4242
"casting `{0}` to `{1}` causes a loss of precision {2}(`{0}` is {3} bits wide, \
4343
but `{1}`'s mantissa is only {4} bits wide)",
4444
cast_from,

clippy_lints/src/casts/cast_ptr_alignment.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ fn lint_cast_ptr_alignment<'tcx>(cx: &LateContext<'tcx>, expr: &Expr<'_>, cast_f
4848
cx,
4949
CAST_PTR_ALIGNMENT,
5050
expr.span,
51-
&format!(
51+
format!(
5252
"casting from `{cast_from}` to a more-strictly-aligned pointer (`{cast_to}`) ({} < {} bytes)",
5353
from_layout.align.abi.bytes(),
5454
to_layout.align.abi.bytes(),

clippy_lints/src/casts/cast_sign_loss.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ pub(super) fn check<'cx>(
4747
cx,
4848
CAST_SIGN_LOSS,
4949
expr.span,
50-
&format!("casting `{cast_from}` to `{cast_to}` may lose the sign of the value"),
50+
format!("casting `{cast_from}` to `{cast_to}` may lose the sign of the value"),
5151
);
5252
}
5353
}

clippy_lints/src/casts/cast_slice_different_sizes.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ pub(super) fn check<'tcx>(cx: &LateContext<'tcx>, expr: &Expr<'tcx>, msrv: &Msrv
3535
cx,
3636
CAST_SLICE_DIFFERENT_SIZES,
3737
expr.span,
38-
&format!(
38+
format!(
3939
"casting between raw pointers to `[{}]` (element size {from_size}) and `[{}]` (element size {to_size}) does not adjust the count",
4040
start_ty.ty, end_ty.ty,
4141
),

clippy_lints/src/casts/cast_slice_from_raw_parts.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ pub(super) fn check(cx: &LateContext<'_>, expr: &Expr<'_>, cast_expr: &Expr<'_>,
4646
cx,
4747
CAST_SLICE_FROM_RAW_PARTS,
4848
span,
49-
&format!("casting the result of `{func}` to {cast_to}"),
49+
format!("casting the result of `{func}` to {cast_to}"),
5050
"replace with",
5151
format!("core::ptr::slice_{func}({ptr}, {len})"),
5252
applicability,

clippy_lints/src/casts/fn_to_numeric_cast.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ pub(super) fn check(cx: &LateContext<'_>, expr: &Expr<'_>, cast_expr: &Expr<'_>,
2525
cx,
2626
FN_TO_NUMERIC_CAST,
2727
expr.span,
28-
&format!("casting function pointer `{from_snippet}` to `{cast_to}`"),
28+
format!("casting function pointer `{from_snippet}` to `{cast_to}`"),
2929
"try",
3030
format!("{from_snippet} as usize"),
3131
applicability,

clippy_lints/src/casts/fn_to_numeric_cast_any.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ pub(super) fn check(cx: &LateContext<'_>, expr: &Expr<'_>, cast_expr: &Expr<'_>,
2323
cx,
2424
FN_TO_NUMERIC_CAST_ANY,
2525
expr.span,
26-
&format!("casting function pointer `{from_snippet}` to `{cast_to}`"),
26+
format!("casting function pointer `{from_snippet}` to `{cast_to}`"),
2727
"did you mean to invoke the function?",
2828
format!("{from_snippet}() as {cast_to}"),
2929
applicability,

clippy_lints/src/casts/fn_to_numeric_cast_with_truncation.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ pub(super) fn check(cx: &LateContext<'_>, expr: &Expr<'_>, cast_expr: &Expr<'_>,
2424
cx,
2525
FN_TO_NUMERIC_CAST_WITH_TRUNCATION,
2626
expr.span,
27-
&format!("casting function pointer `{from_snippet}` to `{cast_to}`, which truncates the value"),
27+
format!("casting function pointer `{from_snippet}` to `{cast_to}`, which truncates the value"),
2828
"try",
2929
format!("{from_snippet} as usize"),
3030
applicability,

clippy_lints/src/casts/ptr_cast_constness.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ pub(super) fn check<'tcx>(
4242
PTR_CAST_CONSTNESS,
4343
expr.span,
4444
"`as` casting between raw pointers while changing only its constness",
45-
&format!("try `pointer::cast_{constness}`, a safer alternative"),
45+
format!("try `pointer::cast_{constness}`, a safer alternative"),
4646
format!("{}.cast_{constness}()", sugg.maybe_par()),
4747
Applicability::MachineApplicable,
4848
);

clippy_lints/src/casts/unnecessary_cast.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ pub(super) fn check<'tcx>(
5151
cx,
5252
UNNECESSARY_CAST,
5353
expr.span,
54-
&format!(
54+
format!(
5555
"casting raw pointers to the same type and constness is unnecessary (`{cast_from}` -> `{cast_to}`)"
5656
),
5757
"try",
@@ -166,7 +166,7 @@ pub(super) fn check<'tcx>(
166166
cx,
167167
UNNECESSARY_CAST,
168168
expr.span,
169-
&format!("casting to the same type is unnecessary (`{cast_from}` -> `{cast_to}`)"),
169+
format!("casting to the same type is unnecessary (`{cast_from}` -> `{cast_to}`)"),
170170
"try",
171171
if needs_block {
172172
format!("{{ {cast_str} }}")
@@ -209,7 +209,7 @@ fn lint_unnecessary_cast(
209209
cx,
210210
UNNECESSARY_CAST,
211211
expr.span,
212-
&format!("casting {literal_kind_name} literal to `{cast_to}` is unnecessary"),
212+
format!("casting {literal_kind_name} literal to `{cast_to}` is unnecessary"),
213213
"try",
214214
sugg,
215215
Applicability::MachineApplicable,

clippy_lints/src/cognitive_complexity.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ impl CognitiveComplexity {
121121
cx,
122122
COGNITIVE_COMPLEXITY,
123123
fn_span,
124-
&format!(
124+
format!(
125125
"the function has a cognitive complexity of ({cc}/{})",
126126
self.limit.limit()
127127
),

clippy_lints/src/default.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ impl<'tcx> LateLintPass<'tcx> for Default {
100100
cx,
101101
DEFAULT_TRAIT_ACCESS,
102102
expr.span,
103-
&format!("calling `{replacement}` is more clear than this expression"),
103+
format!("calling `{replacement}` is more clear than this expression"),
104104
"try",
105105
replacement,
106106
Applicability::Unspecified, // First resolve the TODO above
@@ -243,7 +243,7 @@ impl<'tcx> LateLintPass<'tcx> for Default {
243243
first_assign.unwrap().span,
244244
"field assignment outside of initializer for an instance created with Default::default()",
245245
Some(local.span),
246-
&format!("consider initializing the variable with `{sugg}` and removing relevant reassignments"),
246+
format!("consider initializing the variable with `{sugg}` and removing relevant reassignments"),
247247
);
248248
self.reassigned_linted.insert(span);
249249
}

clippy_lints/src/default_instead_of_iter_empty.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ impl<'tcx> LateLintPass<'tcx> for DefaultIterEmpty {
4949
cx,
5050
DEFAULT_INSTEAD_OF_ITER_EMPTY,
5151
expr.span,
52-
&format!("`{path}()` is the more idiomatic way"),
52+
format!("`{path}()` is the more idiomatic way"),
5353
"try",
5454
sugg,
5555
applicability,

clippy_lints/src/default_union_representation.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ impl<'tcx> LateLintPass<'tcx> for DefaultUnionRepresentation {
6262
item.span,
6363
"this union has the default representation",
6464
None,
65-
&format!(
65+
format!(
6666
"consider annotating `{}` with `#[repr(C)]` to explicitly specify memory layout",
6767
cx.tcx.def_path_str(item.owner_id)
6868
),

0 commit comments

Comments
 (0)