Skip to content

Commit 9716a9e

Browse files
committed
adding condition for map_clone message
if msrv < 1.36, the message tells , but the suggestion is
1 parent 89ee6aa commit 9716a9e

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

clippy_lints/src/map_clone.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ fn lint_needless_cloning(cx: &LateContext<'_>, root: Span, receiver: Span) {
143143
impl MapClone {
144144
fn lint_explicit_closure(&self, cx: &LateContext<'_>, replace: Span, root: Span, is_copy: bool) {
145145
let mut applicability = Applicability::MachineApplicable;
146-
let message = if is_copy {
146+
let message = if is_copy && meets_msrv(self.msrv.as_ref(), &msrvs::ITERATOR_COPIED) {
147147
"you are using an explicit closure for copying elements"
148148
} else {
149149
"you are using an explicit closure for cloning elements"

tests/ui-toml/min_rust_version/min_rust_version.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: you are using an explicit closure for copying elements
1+
error: you are using an explicit closure for cloning elements
22
--> $DIR/min_rust_version.rs:74:26
33
|
44
LL | let _: Option<u64> = Some(&16).map(|b| *b);

0 commit comments

Comments
 (0)