]> git.lizzy.rs Git - rust.git/commitdiff
remove redundant clones
authorMatthias Krüger <matthias.krueger@famsik.de>
Sun, 15 Jan 2023 14:02:02 +0000 (15:02 +0100)
committerMatthias Krüger <matthias.krueger@famsik.de>
Sun, 15 Jan 2023 14:02:02 +0000 (15:02 +0100)
compiler/rustc_lint/src/internal.rs
compiler/rustc_lint/src/pass_by_value.rs

index 5eb54cc0034279392c1eac3a4cdf8ad6b7d78b80..6cefaea2bc7da8af59508ff2cad32366ccce9d54 100644 (file)
@@ -187,9 +187,9 @@ fn check_ty(&mut self, cx: &LateContext<'_>, ty: &'tcx Ty<'tcx>) {
                         },
                         None => cx.emit_spanned_lint(USAGE_OF_TY_TYKIND, path.span, TykindDiag),
                     }
-                } else if !ty.span.from_expansion() && path.segments.len() > 1 && let Some(t) = is_ty_or_ty_ctxt(cx, &path) {
+                } else if !ty.span.from_expansion() && path.segments.len() > 1 && let Some(ty) = is_ty_or_ty_ctxt(cx, &path) {
                     cx.emit_spanned_lint(USAGE_OF_QUALIFIED_TY, path.span, TyQualified {
-                        ty: t.clone(),
+                        ty,
                         suggestion: path.span,
                     });
                 }
index 57482a9edba880761fd97b38a0b4dc567aba419d..392e13f2fa94165d802ac24c0913934dd5d43d1b 100644 (file)
@@ -32,7 +32,7 @@ fn check_ty(&mut self, cx: &LateContext<'_>, ty: &'tcx hir::Ty<'tcx>) {
                     cx.emit_spanned_lint(
                         PASS_BY_VALUE,
                         ty.span,
-                        PassByValueDiag { ty: t.clone(), suggestion: ty.span },
+                        PassByValueDiag { ty: t, suggestion: ty.span },
                     );
                 }
             }