Skip to content

Commit bdfea1c

Browse files
committed
Pass msrvs by copy
1 parent 9c78883 commit bdfea1c

36 files changed

+70
-72
lines changed

clippy_lints/src/approx_const.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,7 @@ impl ApproxConstant {
8787
let s = s.as_str();
8888
if s.parse::<f64>().is_ok() {
8989
for &(constant, name, min_digits, msrv) in &KNOWN_CONSTS {
90-
if is_approx_const(constant, s, min_digits)
91-
&& msrv.as_ref().map_or(true, |msrv| meets_msrv(self.msrv.as_ref(), msrv))
92-
{
90+
if is_approx_const(constant, s, min_digits) && msrv.map_or(true, |msrv| meets_msrv(self.msrv, msrv)) {
9391
span_lint_and_help(
9492
cx,
9593
APPROX_CONSTANT,

clippy_lints/src/attrs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,7 @@ fn check_empty_line_after_outer_attr(cx: &EarlyContext<'_>, item: &rustc_ast::It
613613

614614
fn check_deprecated_cfg_attr(cx: &EarlyContext<'_>, attr: &Attribute, msrv: Option<RustcVersion>) {
615615
if_chain! {
616-
if meets_msrv(msrv.as_ref(), &msrvs::TOOL_ATTRIBUTES);
616+
if meets_msrv(msrv, msrvs::TOOL_ATTRIBUTES);
617617
// check cfg_attr
618618
if attr.has_name(sym::cfg_attr);
619619
if let Some(items) = attr.meta_item_list();

clippy_lints/src/borrow_as_ptr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ impl BorrowAsPtr {
5757

5858
impl<'tcx> LateLintPass<'tcx> for BorrowAsPtr {
5959
fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) {
60-
if !meets_msrv(self.msrv.as_ref(), &msrvs::BORROW_AS_PTR) {
60+
if !meets_msrv(self.msrv, msrvs::BORROW_AS_PTR) {
6161
return;
6262
}
6363

clippy_lints/src/casts/cast_abs_to_unsigned.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ pub(super) fn check(
1616
cast_expr: &Expr<'_>,
1717
cast_from: Ty<'_>,
1818
cast_to: Ty<'_>,
19-
msrv: &Option<RustcVersion>,
19+
msrv: Option<RustcVersion>,
2020
) {
2121
if_chain! {
22-
if meets_msrv(msrv.as_ref(), &msrvs::UNSIGNED_ABS);
22+
if meets_msrv(msrv, msrvs::UNSIGNED_ABS);
2323
if cast_from.is_integral();
2424
if cast_to.is_integral();
2525
if cast_from.is_signed();

clippy_lints/src/casts/cast_lossless.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ pub(super) fn check(
1616
cast_op: &Expr<'_>,
1717
cast_from: Ty<'_>,
1818
cast_to: Ty<'_>,
19-
msrv: &Option<RustcVersion>,
19+
msrv: Option<RustcVersion>,
2020
) {
2121
if !should_lint(cx, expr, cast_from, cast_to, msrv) {
2222
return;
@@ -68,7 +68,7 @@ fn should_lint(
6868
expr: &Expr<'_>,
6969
cast_from: Ty<'_>,
7070
cast_to: Ty<'_>,
71-
msrv: &Option<RustcVersion>,
71+
msrv: Option<RustcVersion>,
7272
) -> bool {
7373
// Do not suggest using From in consts/statics until it is valid to do so (see #2267).
7474
if in_constant(cx, expr.hir_id) {
@@ -95,7 +95,7 @@ fn should_lint(
9595
};
9696
!is_isize_or_usize(cast_from) && from_nbits < to_nbits
9797
},
98-
(false, true) if matches!(cast_from.kind(), ty::Bool) && meets_msrv(msrv.as_ref(), &msrvs::FROM_BOOL) => true,
98+
(false, true) if matches!(cast_from.kind(), ty::Bool) && meets_msrv(msrv, msrvs::FROM_BOOL) => true,
9999
(_, _) => {
100100
matches!(cast_from.kind(), ty::Float(FloatTy::F32)) && matches!(cast_to.kind(), ty::Float(FloatTy::F64))
101101
},

clippy_lints/src/casts/cast_slice_different_sizes.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ use rustc_semver::RustcVersion;
88

99
use super::CAST_SLICE_DIFFERENT_SIZES;
1010

11-
pub(super) fn check<'tcx>(cx: &LateContext<'tcx>, expr: &Expr<'tcx>, msrv: &Option<RustcVersion>) {
11+
pub(super) fn check<'tcx>(cx: &LateContext<'tcx>, expr: &Expr<'tcx>, msrv: Option<RustcVersion>) {
1212
// suggestion is invalid if `ptr::slice_from_raw_parts` does not exist
13-
if !meets_msrv(msrv.as_ref(), &msrvs::PTR_SLICE_RAW_PARTS) {
13+
if !meets_msrv(msrv, msrvs::PTR_SLICE_RAW_PARTS) {
1414
return;
1515
}
1616

clippy_lints/src/casts/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,7 @@ impl_lint_pass!(Casts => [
532532
impl<'tcx> LateLintPass<'tcx> for Casts {
533533
fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) {
534534
if !in_external_macro(cx.sess(), expr.span) {
535-
ptr_as_ptr::check(cx, expr, &self.msrv);
535+
ptr_as_ptr::check(cx, expr, self.msrv);
536536
}
537537

538538
if expr.span.from_expansion() {
@@ -562,18 +562,18 @@ impl<'tcx> LateLintPass<'tcx> for Casts {
562562
cast_possible_wrap::check(cx, expr, cast_from, cast_to);
563563
cast_precision_loss::check(cx, expr, cast_from, cast_to);
564564
cast_sign_loss::check(cx, expr, cast_expr, cast_from, cast_to);
565-
cast_abs_to_unsigned::check(cx, expr, cast_expr, cast_from, cast_to, &self.msrv);
565+
cast_abs_to_unsigned::check(cx, expr, cast_expr, cast_from, cast_to, self.msrv);
566566
}
567-
cast_lossless::check(cx, expr, cast_expr, cast_from, cast_to, &self.msrv);
567+
cast_lossless::check(cx, expr, cast_expr, cast_from, cast_to, self.msrv);
568568
cast_enum_constructor::check(cx, expr, cast_expr, cast_from);
569569
}
570570
}
571571

572572
cast_ref_to_mut::check(cx, expr);
573573
cast_ptr_alignment::check(cx, expr);
574574
char_lit_as_u8::check(cx, expr);
575-
ptr_as_ptr::check(cx, expr, &self.msrv);
576-
cast_slice_different_sizes::check(cx, expr, &self.msrv);
575+
ptr_as_ptr::check(cx, expr, self.msrv);
576+
cast_slice_different_sizes::check(cx, expr, self.msrv);
577577
}
578578

579579
extract_msrv_attr!(LateContext);

clippy_lints/src/casts/ptr_as_ptr.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ use rustc_semver::RustcVersion;
1212

1313
use super::PTR_AS_PTR;
1414

15-
pub(super) fn check(cx: &LateContext<'_>, expr: &Expr<'_>, msrv: &Option<RustcVersion>) {
16-
if !meets_msrv(msrv.as_ref(), &msrvs::POINTER_CAST) {
15+
pub(super) fn check(cx: &LateContext<'_>, expr: &Expr<'_>, msrv: Option<RustcVersion>) {
16+
if !meets_msrv(msrv, msrvs::POINTER_CAST) {
1717
return;
1818
}
1919

clippy_lints/src/checked_conversions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ impl_lint_pass!(CheckedConversions => [CHECKED_CONVERSIONS]);
5757

5858
impl<'tcx> LateLintPass<'tcx> for CheckedConversions {
5959
fn check_expr(&mut self, cx: &LateContext<'_>, item: &Expr<'_>) {
60-
if !meets_msrv(self.msrv.as_ref(), &msrvs::TRY_FROM) {
60+
if !meets_msrv(self.msrv, msrvs::TRY_FROM) {
6161
return;
6262
}
6363

clippy_lints/src/from_over_into.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ impl_lint_pass!(FromOverInto => [FROM_OVER_INTO]);
5555

5656
impl<'tcx> LateLintPass<'tcx> for FromOverInto {
5757
fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx hir::Item<'_>) {
58-
if !meets_msrv(self.msrv.as_ref(), &msrvs::RE_REBALANCING_COHERENCE) {
58+
if !meets_msrv(self.msrv, msrvs::RE_REBALANCING_COHERENCE) {
5959
return;
6060
}
6161

clippy_lints/src/if_then_some_else_none.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ impl_lint_pass!(IfThenSomeElseNone => [IF_THEN_SOME_ELSE_NONE]);
5757

5858
impl<'tcx> LateLintPass<'tcx> for IfThenSomeElseNone {
5959
fn check_expr(&mut self, cx: &LateContext<'_>, expr: &'tcx Expr<'_>) {
60-
if !meets_msrv(self.msrv.as_ref(), &msrvs::BOOL_THEN) {
60+
if !meets_msrv(self.msrv, msrvs::BOOL_THEN) {
6161
return;
6262
}
6363

clippy_lints/src/index_refutable_slice.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ impl<'tcx> LateLintPass<'tcx> for IndexRefutableSlice {
7575
if !expr.span.from_expansion() || is_expn_of(expr.span, "if_chain").is_some();
7676
if let Some(IfLet {let_pat, if_then, ..}) = IfLet::hir(cx, expr);
7777
if !is_lint_allowed(cx, INDEX_REFUTABLE_SLICE, expr.hir_id);
78-
if meets_msrv(self.msrv.as_ref(), &msrvs::SLICE_PATTERNS);
78+
if meets_msrv(self.msrv, msrvs::SLICE_PATTERNS);
7979

8080
let found_slices = find_slice_values(cx, let_pat);
8181
if !found_slices.is_empty();

clippy_lints/src/manual_bits.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ impl_lint_pass!(ManualBits => [MANUAL_BITS]);
4848

4949
impl<'tcx> LateLintPass<'tcx> for ManualBits {
5050
fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) {
51-
if !meets_msrv(self.msrv.as_ref(), &msrvs::MANUAL_BITS) {
51+
if !meets_msrv(self.msrv, msrvs::MANUAL_BITS) {
5252
return;
5353
}
5454

clippy_lints/src/manual_non_exhaustive.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ impl_lint_pass!(ManualNonExhaustiveEnum => [MANUAL_NON_EXHAUSTIVE]);
9898

9999
impl EarlyLintPass for ManualNonExhaustiveStruct {
100100
fn check_item(&mut self, cx: &EarlyContext<'_>, item: &ast::Item) {
101-
if !meets_msrv(self.msrv.as_ref(), &msrvs::NON_EXHAUSTIVE) {
101+
if !meets_msrv(self.msrv, msrvs::NON_EXHAUSTIVE) {
102102
return;
103103
}
104104

@@ -150,7 +150,7 @@ impl EarlyLintPass for ManualNonExhaustiveStruct {
150150

151151
impl<'tcx> LateLintPass<'tcx> for ManualNonExhaustiveEnum {
152152
fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx hir::Item<'_>) {
153-
if !meets_msrv(self.msrv.as_ref(), &msrvs::NON_EXHAUSTIVE) {
153+
if !meets_msrv(self.msrv, msrvs::NON_EXHAUSTIVE) {
154154
return;
155155
}
156156

clippy_lints/src/manual_strip.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ enum StripKind {
6868

6969
impl<'tcx> LateLintPass<'tcx> for ManualStrip {
7070
fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) {
71-
if !meets_msrv(self.msrv.as_ref(), &msrvs::STR_STRIP_PREFIX) {
71+
if !meets_msrv(self.msrv, msrvs::STR_STRIP_PREFIX) {
7272
return;
7373
}
7474

clippy_lints/src/map_clone.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ impl MapClone {
144144
fn lint_explicit_closure(&self, cx: &LateContext<'_>, replace: Span, root: Span, is_copy: bool) {
145145
let mut applicability = Applicability::MachineApplicable;
146146

147-
let (message, sugg_method) = if is_copy && meets_msrv(self.msrv.as_ref(), &msrvs::ITERATOR_COPIED) {
147+
let (message, sugg_method) = if is_copy && meets_msrv(self.msrv, msrvs::ITERATOR_COPIED) {
148148
("you are using an explicit closure for copying elements", "copied")
149149
} else {
150150
("you are using an explicit closure for cloning elements", "cloned")

clippy_lints/src/matches/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -658,7 +658,7 @@ impl<'tcx> LateLintPass<'tcx> for Matches {
658658
}
659659
if !contains_cfg_arm(cx, expr, ex, arms) {
660660
if source == MatchSource::Normal {
661-
if !(meets_msrv(self.msrv.as_ref(), &msrvs::MATCHES_MACRO)
661+
if !(meets_msrv(self.msrv, msrvs::MATCHES_MACRO)
662662
&& match_like_matches::check_match(cx, expr, ex, arms))
663663
{
664664
match_same_arms::check(cx, arms);
@@ -685,7 +685,7 @@ impl<'tcx> LateLintPass<'tcx> for Matches {
685685
match_wild_err_arm::check(cx, ex, arms);
686686
wild_in_or_pats::check(cx, arms);
687687
} else {
688-
if meets_msrv(self.msrv.as_ref(), &msrvs::MATCHES_MACRO) {
688+
if meets_msrv(self.msrv, msrvs::MATCHES_MACRO) {
689689
match_like_matches::check(cx, expr);
690690
}
691691
redundant_pattern_match::check(cx, expr);

clippy_lints/src/mem_replace.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ impl<'tcx> LateLintPass<'tcx> for MemReplace {
254254
then {
255255
check_replace_option_with_none(cx, src, dest, expr.span);
256256
check_replace_with_uninit(cx, src, dest, expr.span);
257-
if meets_msrv(self.msrv.as_ref(), &msrvs::MEM_TAKE) {
257+
if meets_msrv(self.msrv, msrvs::MEM_TAKE) {
258258
check_replace_with_default(cx, src, dest, expr.span);
259259
}
260260
}

clippy_lints/src/methods/cloned_instead_of_copied.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,16 @@ use rustc_span::{sym, Span};
1010

1111
use super::CLONED_INSTEAD_OF_COPIED;
1212

13-
pub fn check(cx: &LateContext<'_>, expr: &Expr<'_>, recv: &Expr<'_>, span: Span, msrv: Option<&RustcVersion>) {
13+
pub fn check(cx: &LateContext<'_>, expr: &Expr<'_>, recv: &Expr<'_>, span: Span, msrv: Option<RustcVersion>) {
1414
let recv_ty = cx.typeck_results().expr_ty_adjusted(recv);
1515
let inner_ty = match recv_ty.kind() {
1616
// `Option<T>` -> `T`
1717
ty::Adt(adt, subst)
18-
if cx.tcx.is_diagnostic_item(sym::Option, adt.did()) && meets_msrv(msrv, &msrvs::OPTION_COPIED) =>
18+
if cx.tcx.is_diagnostic_item(sym::Option, adt.did()) && meets_msrv(msrv, msrvs::OPTION_COPIED) =>
1919
{
2020
subst.type_at(0)
2121
},
22-
_ if is_trait_method(cx, expr, sym::Iterator) && meets_msrv(msrv, &msrvs::ITERATOR_COPIED) => {
22+
_ if is_trait_method(cx, expr, sym::Iterator) && meets_msrv(msrv, msrvs::ITERATOR_COPIED) => {
2323
match get_iterator_item_ty(cx, recv_ty) {
2424
// <T as Iterator>::Item
2525
Some(ty) => ty,

clippy_lints/src/methods/err_expect.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ pub(super) fn check(
1313
cx: &LateContext<'_>,
1414
_expr: &rustc_hir::Expr<'_>,
1515
recv: &rustc_hir::Expr<'_>,
16-
msrv: Option<&RustcVersion>,
16+
msrv: Option<RustcVersion>,
1717
expect_span: Span,
1818
err_span: Span,
1919
) {
2020
if_chain! {
2121
if is_type_diagnostic_item(cx, cx.typeck_results().expr_ty(recv), sym::Result);
2222
// Test the version to make sure the lint can be showed (expect_err has been
2323
// introduced in rust 1.17.0 : https://github.com/rust-lang/rust/pull/38982)
24-
if meets_msrv(msrv, &msrvs::EXPECT_ERR);
24+
if meets_msrv(msrv, msrvs::EXPECT_ERR);
2525

2626
// Grabs the `Result<T, E>` type
2727
let result_type = cx.typeck_results().expr_ty(recv);

clippy_lints/src/methods/filter_map_next.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ pub(super) fn check<'tcx>(
1414
expr: &'tcx hir::Expr<'_>,
1515
recv: &'tcx hir::Expr<'_>,
1616
arg: &'tcx hir::Expr<'_>,
17-
msrv: Option<&RustcVersion>,
17+
msrv: Option<RustcVersion>,
1818
) {
1919
if is_trait_method(cx, expr, sym::Iterator) {
20-
if !meets_msrv(msrv, &msrvs::ITERATOR_FIND_MAP) {
20+
if !meets_msrv(msrv, msrvs::ITERATOR_FIND_MAP) {
2121
return;
2222
}
2323

clippy_lints/src/methods/is_digit_ascii_radix.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ pub(super) fn check<'tcx>(
1515
expr: &'tcx Expr<'_>,
1616
self_arg: &'tcx Expr<'_>,
1717
radix: &'tcx Expr<'_>,
18-
msrv: Option<&RustcVersion>,
18+
msrv: Option<RustcVersion>,
1919
) {
20-
if !meets_msrv(msrv, &msrvs::IS_ASCII_DIGIT) {
20+
if !meets_msrv(msrv, msrvs::IS_ASCII_DIGIT) {
2121
return;
2222
}
2323

clippy_lints/src/methods/map_unwrap_or.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ pub(super) fn check<'tcx>(
1919
recv: &'tcx hir::Expr<'_>,
2020
map_arg: &'tcx hir::Expr<'_>,
2121
unwrap_arg: &'tcx hir::Expr<'_>,
22-
msrv: Option<&RustcVersion>,
22+
msrv: Option<RustcVersion>,
2323
) -> bool {
2424
// lint if the caller of `map()` is an `Option`
2525
let is_option = is_type_diagnostic_item(cx, cx.typeck_results().expr_ty(recv), sym::Option);
2626
let is_result = is_type_diagnostic_item(cx, cx.typeck_results().expr_ty(recv), sym::Result);
2727

28-
if is_result && !meets_msrv(msrv, &msrvs::RESULT_MAP_OR_ELSE) {
28+
if is_result && !meets_msrv(msrv, msrvs::RESULT_MAP_OR_ELSE) {
2929
return false;
3030
}
3131

clippy_lints/src/methods/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2306,7 +2306,7 @@ impl<'tcx> LateLintPass<'tcx> for Methods {
23062306
return;
23072307
}
23082308

2309-
check_methods(cx, expr, self.msrv.as_ref());
2309+
check_methods(cx, expr, self.msrv);
23102310

23112311
match expr.kind {
23122312
hir::ExprKind::Call(func, args) => {
@@ -2322,7 +2322,7 @@ impl<'tcx> LateLintPass<'tcx> for Methods {
23222322
single_char_add_str::check(cx, expr, args);
23232323
into_iter_on_ref::check(cx, expr, method_span, method_call.ident.name, args);
23242324
single_char_pattern::check(cx, expr, method_call.ident.name, args);
2325-
unnecessary_to_owned::check(cx, expr, method_call.ident.name, args, self.msrv.as_ref());
2325+
unnecessary_to_owned::check(cx, expr, method_call.ident.name, args, self.msrv);
23262326
},
23272327
hir::ExprKind::Binary(op, lhs, rhs) if op.node == hir::BinOpKind::Eq || op.node == hir::BinOpKind::Ne => {
23282328
let mut info = BinaryExprInfo {
@@ -2506,7 +2506,7 @@ impl<'tcx> LateLintPass<'tcx> for Methods {
25062506
}
25072507

25082508
#[allow(clippy::too_many_lines)]
2509-
fn check_methods<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>, msrv: Option<&RustcVersion>) {
2509+
fn check_methods<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>, msrv: Option<RustcVersion>) {
25102510
if let Some((name, [recv, args @ ..], span)) = method_call(expr) {
25112511
match (name, args) {
25122512
("add" | "offset" | "sub" | "wrapping_offset" | "wrapping_add" | "wrapping_sub", [_arg]) => {
@@ -2534,7 +2534,7 @@ fn check_methods<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>, msrv: Optio
25342534
map_collect_result_unit::check(cx, expr, m_recv, m_arg, recv);
25352535
},
25362536
Some(("take", [take_self_arg, take_arg], _)) => {
2537-
if meets_msrv(msrv, &msrvs::STR_REPEAT) {
2537+
if meets_msrv(msrv, msrvs::STR_REPEAT) {
25382538
manual_str_repeat::check(cx, expr, recv, take_self_arg, take_arg);
25392539
}
25402540
},

clippy_lints/src/methods/option_as_ref_deref.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ pub(super) fn check<'tcx>(
1919
as_ref_recv: &hir::Expr<'_>,
2020
map_arg: &hir::Expr<'_>,
2121
is_mut: bool,
22-
msrv: Option<&RustcVersion>,
22+
msrv: Option<RustcVersion>,
2323
) {
24-
if !meets_msrv(msrv, &msrvs::OPTION_AS_DEREF) {
24+
if !meets_msrv(msrv, msrvs::OPTION_AS_DEREF) {
2525
return;
2626
}
2727

clippy_lints/src/methods/str_splitn.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ pub(super) fn check(
2424
self_arg: &Expr<'_>,
2525
pat_arg: &Expr<'_>,
2626
count: u128,
27-
msrv: Option<&RustcVersion>,
27+
msrv: Option<RustcVersion>,
2828
) {
2929
if count < 2 || !cx.typeck_results().expr_ty_adjusted(self_arg).peel_refs().is_str() {
3030
return;
@@ -34,7 +34,7 @@ pub(super) fn check(
3434
IterUsageKind::Nth(n) => count > n + 1,
3535
IterUsageKind::NextTuple => count > 2,
3636
};
37-
let manual = count == 2 && meets_msrv(msrv, &msrvs::STR_SPLIT_ONCE);
37+
let manual = count == 2 && meets_msrv(msrv, msrvs::STR_SPLIT_ONCE);
3838

3939
match parse_iter_usage(cx, expr.span.ctxt(), cx.tcx.hir().parent_iter(expr.hir_id)) {
4040
Some(usage) if needless(usage.kind) => lint_needless(cx, method_name, expr, self_arg, pat_arg),

0 commit comments

Comments
 (0)