]> git.lizzy.rs Git - rust.git/blobdiff - src/tools/clippy/clippy_lints/src/methods/suspicious_to_owned.rs
Merge commit '7f27e2e74ef957baa382dc05cf08df6368165c74' into clippyup
[rust.git] / src / tools / clippy / clippy_lints / src / methods / suspicious_to_owned.rs
index 15c1c618c5137e76069e3b0e3b02008b1e5bb8fa..fe88fa41fd91efd3cdf558f836ed41ba8f210b7f 100644 (file)
@@ -5,7 +5,7 @@
 use rustc_errors::Applicability;
 use rustc_hir as hir;
 use rustc_lint::LateContext;
-use rustc_middle::ty;
+use rustc_middle::ty::{self, print::with_forced_trimmed_paths};
 use rustc_span::sym;
 
 use super::SUSPICIOUS_TO_OWNED;
@@ -24,7 +24,9 @@ pub fn check(cx: &LateContext<'_>, expr: &hir::Expr<'_>, recv: &hir::Expr<'_>) -
                 cx,
                 SUSPICIOUS_TO_OWNED,
                 expr.span,
-                &format!("this `to_owned` call clones the {input_type} itself and does not cause the {input_type} contents to become owned"),
+                &with_forced_trimmed_paths!(format!(
+                    "this `to_owned` call clones the {input_type} itself and does not cause the {input_type} contents to become owned"
+                )),
                 "consider using, depending on intent",
                 format!("{recv_snip}.clone()` or `{recv_snip}.into_owned()"),
                 app,