]> git.lizzy.rs Git - rust.git/blobdiff - clippy_lints/src/utils/sugg.rs
Use span_suggestion_with_applicability instead of span_suggestion
[rust.git] / clippy_lints / src / utils / sugg.rs
index f849cef093a65b27fdd5e11ee43463bd84b87b1d..f7d8c1fc15122526660cdbe2b7b124d680ce630a 100644 (file)
@@ -15,6 +15,7 @@
 use crate::syntax::ast;
 use crate::utils::{higher, snippet, snippet_opt};
 use crate::syntax_pos::{BytePos, Pos};
+use crate::rustc_errors::Applicability;
 
 /// A helper type to build suggestion correctly handling parenthesis.
 pub enum Sugg<'a> {
@@ -496,7 +497,12 @@ fn suggest_item_with_attr<D: Display + ?Sized>(&mut self, cx: &T, item: Span, ms
         if let Some(indent) = indentation(cx, item) {
             let span = item.with_hi(item.lo());
 
-            self.span_suggestion(span, msg, format!("{}\n{}", attr, indent));
+            self.span_suggestion_with_applicability(
+                        span,
+                        msg,
+                        format!("{}\n{}", attr, indent),
+                        Applicability::Unspecified,
+                        );
         }
     }
 
@@ -517,7 +523,12 @@ fn suggest_prepend_item(&mut self, cx: &T, item: Span, msg: &str, new_item: &str
                 })
                 .collect::<String>();
 
-            self.span_suggestion(span, msg, format!("{}\n{}", new_item, indent));
+            self.span_suggestion_with_applicability(
+                        span,
+                        msg,
+                        format!("{}\n{}", new_item, indent),
+                        Applicability::Unspecified,
+                        );
         }
     }
 
@@ -534,6 +545,11 @@ fn suggest_remove_item(&mut self, cx: &T, item: Span, msg: &str) {
             }
         }
 
-        self.span_suggestion(remove_span, msg, String::new());
+        self.span_suggestion_with_applicability(
+                    remove_span,
+                    msg,
+                    String::new(),
+                    Applicability::Unspecified,
+                    );
     }
 }