Skip to content

Commit 1b9516a

Browse files
committed
Cleanup: rename Applicability variables/parameters
1 parent 5b23bd4 commit 1b9516a

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
@@ -255,15 +255,15 @@ fn is_conditional(expr: &Expr<'_>) -> bool {
255255

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

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 is_trait_method(cx, expr, 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
@@ -219,7 +219,7 @@ impl LazyInfo {
219219
fn lint(&self, cx: &LateContext<'_>, sugg_map: &FxIndexMap<DefId, Option<String>>) {
220220
// Applicability might get adjusted to `Unspecified` later if any calls
221221
// in `calls_span_and_id` are not replaceable judging by the `sugg_map`.
222-
let mut appl = Applicability::MachineApplicable;
222+
let mut app = Applicability::MachineApplicable;
223223
let mut suggs = vec![(self.ty_span_no_args, "std::sync::LazyLock".to_string())];
224224

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

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

0 commit comments

Comments
 (0)