]> git.lizzy.rs Git - rust.git/blobdiff - clippy_lints/src/infallible_destructuring_match.rs
Merge branch 'macro-use' into HEAD
[rust.git] / clippy_lints / src / infallible_destructuring_match.rs
index a2b3846b986fbd9914b4395487f1b4cb315d7fce..8b8cb32deb1afedcb8aeca0e7bf4eb2831aeb24c 100644 (file)
@@ -1,6 +1,8 @@
 use super::utils::{get_arg_name, match_var, remove_blocks, snippet, span_lint_and_sugg};
 use rustc::hir::*;
 use rustc::lint::*;
+use rustc::{declare_lint, lint_array};
+use if_chain::if_chain;
 
 /// **What it does:** Checks for matches being used to destructure a single-variant enum
 /// or tuple struct where a `let` will suffice.
@@ -50,7 +52,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
     fn check_local(&mut self, cx: &LateContext<'a, 'tcx>, local: &'tcx Local) {
         if_chain! {
             if let Some(ref expr) = local.init;
-            if let Expr_::ExprMatch(ref target, ref arms, MatchSource::Normal) = expr.node;
+            if let ExprKind::Match(ref target, ref arms, MatchSource::Normal) = expr.node;
             if arms.len() == 1 && arms[0].pats.len() == 1 && arms[0].guard.is_none();
             if let PatKind::TupleStruct(QPath::Resolved(None, ref variant_name), ref args, _) = arms[0].pats[0].node;
             if args.len() == 1;