diff options
| author | kyoto7250 <50972773+kyoto7250@users.noreply.github.com> | 2022-04-12 04:03:48 +0900 |
|---|---|---|
| committer | kyoto7250 <50972773+kyoto7250@users.noreply.github.com> | 2022-04-12 04:03:48 +0900 |
| commit | 9716a9eff0d68c92fd064b293f0ffbd083645fa5 (patch) | |
| tree | 68cb1d8eb7c54b43a752f78df0aa66c0fdb00e77 | |
| parent | 89ee6aa6e32df974ef9dbb3c825afbdce441e856 (diff) | |
| download | rust-9716a9eff0d68c92fd064b293f0ffbd083645fa5.tar.gz rust-9716a9eff0d68c92fd064b293f0ffbd083645fa5.zip | |
adding condition for map_clone message
if msrv < 1.36, the message tells , but the suggestion is
| -rw-r--r-- | clippy_lints/src/map_clone.rs | 2 | ||||
| -rw-r--r-- | tests/ui-toml/min_rust_version/min_rust_version.stderr | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/clippy_lints/src/map_clone.rs b/clippy_lints/src/map_clone.rs index e233300e26a..a03d5d54065 100644 --- a/clippy_lints/src/map_clone.rs +++ b/clippy_lints/src/map_clone.rs @@ -143,7 +143,7 @@ fn lint_needless_cloning(cx: &LateContext<'_>, root: Span, receiver: Span) { impl MapClone { fn lint_explicit_closure(&self, cx: &LateContext<'_>, replace: Span, root: Span, is_copy: bool) { let mut applicability = Applicability::MachineApplicable; - let message = if is_copy { + let message = if is_copy && meets_msrv(self.msrv.as_ref(), &msrvs::ITERATOR_COPIED) { "you are using an explicit closure for copying elements" } else { "you are using an explicit closure for cloning elements" diff --git a/tests/ui-toml/min_rust_version/min_rust_version.stderr b/tests/ui-toml/min_rust_version/min_rust_version.stderr index a1e7361c0cb..5dae5af7eb5 100644 --- a/tests/ui-toml/min_rust_version/min_rust_version.stderr +++ b/tests/ui-toml/min_rust_version/min_rust_version.stderr @@ -1,4 +1,4 @@ -error: you are using an explicit closure for copying elements +error: you are using an explicit closure for cloning elements --> $DIR/min_rust_version.rs:74:26 | LL | let _: Option<u64> = Some(&16).map(|b| *b); |
