]> git.proxmox.com Git - rustc.git/blobdiff - src/tools/clippy/clippy_lints/src/map_clone.rs
New upstream version 1.62.1+dfsg1
[rustc.git] / src / tools / clippy / clippy_lints / src / map_clone.rs
index e233300e26ab898e94efcdbd13b5bee37b6dbcf7..ceb66947d02c6717a0ba802f61268997c00e48f0 100644 (file)
@@ -143,15 +143,11 @@ 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 {
-            "you are using an explicit closure for copying elements"
-        } else {
-            "you are using an explicit closure for cloning elements"
-        };
-        let sugg_method = if is_copy && meets_msrv(self.msrv.as_ref(), &msrvs::ITERATOR_COPIED) {
-            "copied"
+
+        let (message, sugg_method) = if is_copy && meets_msrv(self.msrv.as_ref(), &msrvs::ITERATOR_COPIED) {
+            ("you are using an explicit closure for copying elements", "copied")
         } else {
-            "cloned"
+            ("you are using an explicit closure for cloning elements", "cloned")
         };
 
         span_lint_and_sugg(