Skip to content

Commit 8a852b7

Browse files
committed
Permit using repeat..take even if repeat_with is not available in this MSRVS
We were early exiting if we didn't have repeat_with even when we'd suggest repeat.take
1 parent 4ea5076 commit 8a852b7

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

clippy_lints/src/methods/map_with_unused_argument_over_ranges.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,6 @@ pub(super) fn check(
6565
msrv: &Msrv,
6666
method_call_span: Span,
6767
) {
68-
if !msrv.meets(msrvs::REPEAT_WITH) {
69-
return;
70-
}
7168
let mut applicability = Applicability::MaybeIncorrect;
7269
if let Some(range) = higher::Range::hir(receiver)
7370
&& let ExprKind::Closure(Closure { body, .. }) = arg.kind
@@ -86,9 +83,11 @@ pub(super) fn check(
8683
method_to_use_name = "repeat";
8784
let body_snippet = snippet_with_applicability(cx, body_expr.span, "..", &mut applicability);
8885
new_span = (arg.span, body_snippet.to_string());
89-
} else {
86+
} else if msrv.meets(msrvs::REPEAT_WITH) {
9087
method_to_use_name = "repeat_with";
9188
new_span = (param.span, String::new());
89+
} else {
90+
return;
9291
}
9392

9493
span_lint_and_then(

0 commit comments

Comments
 (0)