]> git.proxmox.com Git - rustc.git/blobdiff - src/tools/clippy/clippy_lints/src/needless_pass_by_value.rs
New upstream version 1.62.1+dfsg1
[rustc.git] / src / tools / clippy / clippy_lints / src / needless_pass_by_value.rs
index 5eb7b0f0521e0a81be4e76f1e035bbdda1332698..4034079a90c0d097cbece091e56c388c3068c229 100644 (file)
@@ -85,7 +85,7 @@ impl<'tcx> LateLintPass<'tcx> for NeedlessPassByValue {
         }
 
         match kind {
-            FnKind::ItemFn(.., header, _) => {
+            FnKind::ItemFn(.., header) => {
                 let attrs = cx.tcx.hir().attrs(hir_id);
                 if header.abi != Abi::Rust || requires_exact_signature(attrs) {
                     return;
@@ -235,12 +235,13 @@ impl<'tcx> LateLintPass<'tcx> for NeedlessPassByValue {
                                 for (span, suggestion) in clone_spans {
                                     diag.span_suggestion(
                                         span,
-                                        &snippet_opt(cx, span)
+                                        snippet_opt(cx, span)
                                             .map_or(
                                                 "change the call to".into(),
                                                 |x| Cow::from(format!("change `{}` to", x)),
-                                            ),
-                                        suggestion.into(),
+                                            )
+                                            .as_ref(),
+                                        suggestion,
                                         Applicability::Unspecified,
                                     );
                                 }
@@ -264,12 +265,13 @@ impl<'tcx> LateLintPass<'tcx> for NeedlessPassByValue {
                                 for (span, suggestion) in clone_spans {
                                     diag.span_suggestion(
                                         span,
-                                        &snippet_opt(cx, span)
+                                        snippet_opt(cx, span)
                                             .map_or(
                                                 "change the call to".into(),
                                                 |x| Cow::from(format!("change `{}` to", x))
-                                            ),
-                                        suggestion.into(),
+                                            )
+                                            .as_ref(),
+                                        suggestion,
                                         Applicability::Unspecified,
                                     );
                                 }