about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--clippy_lints/src/trait_bounds.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/clippy_lints/src/trait_bounds.rs b/clippy_lints/src/trait_bounds.rs
index 8de0f92109b..ac61fb157b4 100644
--- a/clippy_lints/src/trait_bounds.rs
+++ b/clippy_lints/src/trait_bounds.rs
@@ -206,13 +206,13 @@ impl<'tcx> LateLintPass<'tcx> for TraitBounds {
             }
         }
 
-        let fixed_trait_snippet = fixed_traits
-            .iter()
-            .filter_map(|b| snippet_opt(cx, b.span))
-            .collect::<Vec<_>>()
-            .join(" + ");
-
         if bounds.len() != fixed_traits.len() {
+            let fixed_trait_snippet = fixed_traits
+                .iter()
+                .filter_map(|b| snippet_opt(cx, b.span))
+                .collect::<Vec<_>>()
+                .join(" + ");
+
             span_lint_and_sugg(
                 cx,
                 TRAIT_DUPLICATION_IN_BOUNDS,