]> git.lizzy.rs Git - rust.git/blobdiff - clippy_lints/src/redundant_pattern_matching.rs
Auto merge of #4551 - mikerite:fix-ice-reporting, r=llogiq
[rust.git] / clippy_lints / src / redundant_pattern_matching.rs
index fe1a29b98833c92d9e983363d4a89f9f0ec538f4..68862f838cb051e2d2315d0701a031d3bf66696a 100644 (file)
@@ -1,10 +1,10 @@
 use crate::utils::{match_qpath, paths, snippet, span_lint_and_then};
+use rustc::hir::ptr::P;
 use rustc::hir::*;
 use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
 use rustc::{declare_lint_pass, declare_tool_lint};
 use rustc_errors::Applicability;
 use syntax::ast::LitKind;
-use syntax::ptr::P;
 
 declare_clippy_lint! {
     /// **What it does:** Lint for redundant pattern matching over `Result` or
@@ -90,13 +90,11 @@ fn find_sugg_for_if_let<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr,
                 db.span_suggestion(
                     span,
                     "try this",
-                    format!("if {}.{}", snippet(cx, op.span, "_"), good_method),
-                    Applicability::MachineApplicable, // snippet
+                    format!("{}.{}", snippet(cx, op.span, "_"), good_method),
+                    Applicability::MaybeIncorrect, // snippet
                 );
             },
         );
-    } else {
-        return;
     }
 }
 
@@ -156,13 +154,11 @@ fn find_sugg_for_match<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr, o
                         span,
                         "try this",
                         format!("{}.{}", snippet(cx, op.span, "_"), good_method),
-                        Applicability::MachineApplicable, // snippet
+                        Applicability::MaybeIncorrect, // snippet
                     );
                 },
             );
         }
-    } else {
-        return;
     }
 }