diff options
| author | Alex Macleod <alex@macleod.io> | 2025-01-18 17:41:57 +0000 |
|---|---|---|
| committer | Alex Macleod <alex@macleod.io> | 2025-02-28 18:15:11 +0000 |
| commit | 5b0004c45fae362f50e9e587f7a16249501d07f8 (patch) | |
| tree | 92109697148bd6c3664edaa24de3053c4dc307d9 /clippy_lints/src/string_patterns.rs | |
| parent | 0972c3b56596b51f9cfdf99a5ad74c754e94d3aa (diff) | |
Migrate `clippy_lints` to new MSRV API
Diffstat (limited to 'clippy_lints/src/string_patterns.rs')
| -rw-r--r-- | clippy_lints/src/string_patterns.rs | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/clippy_lints/src/string_patterns.rs b/clippy_lints/src/string_patterns.rs index 694ad4f6347..5c95dfe8347 100644 --- a/clippy_lints/src/string_patterns.rs +++ b/clippy_lints/src/string_patterns.rs @@ -77,9 +77,7 @@ pub struct StringPatterns { impl StringPatterns { pub fn new(conf: &'static Conf) -> Self { - Self { - msrv: conf.msrv.clone(), - } + Self { msrv: conf.msrv } } } @@ -136,7 +134,7 @@ fn get_char_span<'tcx>(cx: &'_ LateContext<'tcx>, expr: &'tcx Expr<'_>) -> Optio } } -fn check_manual_pattern_char_comparison(cx: &LateContext<'_>, method_arg: &Expr<'_>, msrv: &Msrv) { +fn check_manual_pattern_char_comparison(cx: &LateContext<'_>, method_arg: &Expr<'_>, msrv: Msrv) { if let ExprKind::Closure(closure) = method_arg.kind && let body = cx.tcx.hir_body(closure.body) && let Some(PatKind::Binding(_, binding, ..)) = body.params.first().map(|p| p.pat.kind) @@ -192,7 +190,7 @@ fn check_manual_pattern_char_comparison(cx: &LateContext<'_>, method_arg: &Expr< { return; } - if set_char_spans.len() > 1 && !msrv.meets(msrvs::PATTERN_TRAIT_CHAR_ARRAY) { + if set_char_spans.len() > 1 && !msrv.meets(cx, msrvs::PATTERN_TRAIT_CHAR_ARRAY) { return; } span_lint_and_then( @@ -238,9 +236,7 @@ impl<'tcx> LateLintPass<'tcx> for StringPatterns { { check_single_char_pattern_lint(cx, arg); - check_manual_pattern_char_comparison(cx, arg, &self.msrv); + check_manual_pattern_char_comparison(cx, arg, self.msrv); } } - - extract_msrv_attr!(LateContext); } |
