]> git.lizzy.rs Git - rust.git/blobdiff - clippy_lints/src/default_trait_access.rs
Merge branch 'macro-use' into HEAD
[rust.git] / clippy_lints / src / default_trait_access.rs
index d96ed8db78653e4779db10ed83aaf3e97c980798..4078237e8aa8453ac9f1d65907d5e8fe8f207a80 100644 (file)
@@ -1,5 +1,7 @@
 use rustc::hir::*;
 use rustc::lint::*;
+use rustc::{declare_lint, lint_array};
+use if_chain::if_chain;
 use rustc::ty::TypeVariants;
 
 use crate::utils::{any_parent_is_automatically_derived, match_def_path, opt_def_id, paths, span_lint_and_sugg};
@@ -22,7 +24,7 @@
 /// ```
 declare_clippy_lint! {
     pub DEFAULT_TRAIT_ACCESS,
-    style,
+    pedantic,
     "checks for literal calls to Default::default()"
 }
 
@@ -38,9 +40,9 @@ fn get_lints(&self) -> LintArray {
 impl<'a, 'tcx> LateLintPass<'a, 'tcx> for DefaultTraitAccess {
     fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) {
         if_chain! {
-            if let ExprCall(ref path, ..) = expr.node;
+            if let ExprKind::Call(ref path, ..) = expr.node;
             if !any_parent_is_automatically_derived(cx.tcx, expr.id);
-            if let ExprPath(ref qpath) = path.node;
+            if let ExprKind::Path(ref qpath) = path.node;
             if let Some(def_id) = opt_def_id(cx.tables.qpath_def(qpath, path.hir_id));
             if match_def_path(cx.tcx, def_id, &paths::DEFAULT_TRAIT_METHOD);
             then {