Skip to content

Commit f666547

Browse files
committed
Cleanup: rename Applicability variables/parameters
1 parent ebbbbeb commit f666547

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

clippy_lints/src/loops/utils.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -256,15 +256,15 @@ fn is_conditional(expr: &Expr<'_>) -> bool {
256256

257257
/// If `arg` was the argument to a `for` loop, return the "cleanest" way of writing the
258258
/// actual `Iterator` that the loop uses.
259-
pub(super) fn make_iterator_snippet(cx: &LateContext<'_>, arg: &Expr<'_>, applic_ref: &mut Applicability) -> String {
259+
pub(super) fn make_iterator_snippet(cx: &LateContext<'_>, arg: &Expr<'_>, applicability: &mut Applicability) -> String {
260260
let impls_iterator = cx
261261
.tcx
262262
.get_diagnostic_item(sym::Iterator)
263263
.is_some_and(|id| implements_trait(cx, cx.typeck_results().expr_ty(arg), id, &[]));
264264
if impls_iterator {
265265
format!(
266266
"{}",
267-
sugg::Sugg::hir_with_applicability(cx, arg, "_", applic_ref).maybe_paren()
267+
sugg::Sugg::hir_with_applicability(cx, arg, "_", applicability).maybe_paren()
268268
)
269269
} else {
270270
// (&x).into_iter() ==> x.iter()
@@ -282,12 +282,12 @@ pub(super) fn make_iterator_snippet(cx: &LateContext<'_>, arg: &Expr<'_>, applic
282282
};
283283
format!(
284284
"{}.{method_name}()",
285-
sugg::Sugg::hir_with_applicability(cx, caller, "_", applic_ref).maybe_paren(),
285+
sugg::Sugg::hir_with_applicability(cx, caller, "_", applicability).maybe_paren(),
286286
)
287287
},
288288
_ => format!(
289289
"{}.into_iter()",
290-
sugg::Sugg::hir_with_applicability(cx, arg, "_", applic_ref).maybe_paren()
290+
sugg::Sugg::hir_with_applicability(cx, arg, "_", applicability).maybe_paren()
291291
),
292292
}
293293
}

clippy_lints/src/methods/iter_skip_next.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use super::ITER_SKIP_NEXT;
1212
pub(super) fn check(cx: &LateContext<'_>, expr: &hir::Expr<'_>, recv: &hir::Expr<'_>, arg: &hir::Expr<'_>) {
1313
// lint if caller of skip is an Iterator
1414
if cx.ty_based_def(expr).opt_parent(cx).is_diag_item(cx, sym::Iterator) {
15-
let mut application = Applicability::MachineApplicable;
15+
let mut applicability = Applicability::MachineApplicable;
1616
span_lint_and_then(
1717
cx,
1818
ITER_SKIP_NEXT,
@@ -24,7 +24,7 @@ pub(super) fn check(cx: &LateContext<'_>, expr: &hir::Expr<'_>, recv: &hir::Expr
2424
&& let PatKind::Binding(ann, _, _, _) = pat.kind
2525
&& ann != BindingMode::MUT
2626
{
27-
application = Applicability::Unspecified;
27+
applicability = Applicability::Unspecified;
2828
diag.span_help(
2929
pat.span,
3030
format!("for this change `{}` has to be mutable", snippet(cx, pat.span, "..")),
@@ -35,7 +35,7 @@ pub(super) fn check(cx: &LateContext<'_>, expr: &hir::Expr<'_>, recv: &hir::Expr
3535
expr.span.trim_start(recv.span).unwrap(),
3636
"use `nth` instead",
3737
format!(".nth({})", snippet(cx, arg.span, "..")),
38-
application,
38+
applicability,
3939
);
4040
},
4141
);

clippy_lints/src/non_std_lazy_statics.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ impl LazyInfo {
220220
fn lint(&self, cx: &LateContext<'_>, sugg_map: &FxIndexMap<DefId, Option<String>>) {
221221
// Applicability might get adjusted to `Unspecified` later if any calls
222222
// in `calls_span_and_id` are not replaceable judging by the `sugg_map`.
223-
let mut appl = Applicability::MachineApplicable;
223+
let mut app = Applicability::MachineApplicable;
224224
let mut suggs = vec![(self.ty_span_no_args, "std::sync::LazyLock".to_string())];
225225

226226
for (span, def_id) in &self.calls_span_and_id {
@@ -229,7 +229,7 @@ impl LazyInfo {
229229
suggs.push((*span, sugg));
230230
} else {
231231
// If NO suggested replacement, not machine applicable
232-
appl = Applicability::Unspecified;
232+
app = Applicability::Unspecified;
233233
}
234234
}
235235

@@ -240,7 +240,7 @@ impl LazyInfo {
240240
self.ty_span_no_args,
241241
"this type has been superseded by `LazyLock` in the standard library",
242242
|diag| {
243-
diag.multipart_suggestion("use `std::sync::LazyLock` instead", suggs, appl);
243+
diag.multipart_suggestion("use `std::sync::LazyLock` instead", suggs, app);
244244
},
245245
);
246246
}

0 commit comments

Comments
 (0)