]> git.lizzy.rs Git - rust.git/blobdiff - clippy_lints/src/collapsible_if.rs
Use span_suggestion_with_applicability instead of span_suggestion
[rust.git] / clippy_lints / src / collapsible_if.rs
index 2771006aad3b40652dae6e7f4bd8ae932e628661..c139b0f0c1f15029542e8e332ae00306235b7859 100644 (file)
 //!
 //! This lint is **warn** by default
 
-use rustc::lint::*;
-use rustc::{declare_lint, lint_array};
+use crate::rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass};
+use crate::rustc::{declare_tool_lint, lint_array};
 use if_chain::if_chain;
-use syntax::ast;
+use crate::syntax::ast;
 
 use crate::utils::{in_macro, snippet_block, span_lint_and_sugg, span_lint_and_then};
 use crate::utils::sugg::Sugg;
+use crate::rustc_errors::Applicability;
 
 /// **What it does:** Checks for nested `if` statements which can be collapsed
 /// by `&&`-combining their conditions and for `else { if ... }` expressions
@@ -133,11 +134,13 @@ fn check_collapsible_no_if_let(cx: &EarlyContext<'_>, expr: &ast::Expr, check: &
             span_lint_and_then(cx, COLLAPSIBLE_IF, expr.span, "this if statement can be collapsed", |db| {
                 let lhs = Sugg::ast(cx, check, "..");
                 let rhs = Sugg::ast(cx, check_inner, "..");
-                db.span_suggestion(expr.span,
+                db.span_suggestion_with_applicability(expr.span,
                                    "try",
                                    format!("if {} {}",
                                            lhs.and(&rhs),
-                                           snippet_block(cx, content.span, "..")));
+                                           snippet_block(cx, content.span, "..")),
+                                    Applicability::Unspecified,
+                                    );
             });
         }
     }