]> git.lizzy.rs Git - rust.git/blobdiff - clippy_lints/src/default_trait_access.rs
Auto merge of #4551 - mikerite:fix-ice-reporting, r=llogiq
[rust.git] / clippy_lints / src / default_trait_access.rs
index 3e3663d6d0ae55350f9a9460bcb4e40cde2e296d..fb7ba64836a530795760bb9733a8c4485f4faca5 100644 (file)
@@ -5,7 +5,7 @@
 use rustc::{declare_lint_pass, declare_tool_lint};
 use rustc_errors::Applicability;
 
-use crate::utils::{any_parent_is_automatically_derived, paths, span_lint_and_sugg};
+use crate::utils::{any_parent_is_automatically_derived, match_def_path, paths, span_lint_and_sugg};
 
 declare_clippy_lint! {
     /// **What it does:** Checks for literal calls to `Default::default()`.
@@ -36,8 +36,8 @@ fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) {
             if let ExprKind::Call(ref path, ..) = expr.node;
             if !any_parent_is_automatically_derived(cx.tcx, expr.hir_id);
             if let ExprKind::Path(ref qpath) = path.node;
-            if let Some(def_id) = cx.tables.qpath_def(qpath, path.hir_id).opt_def_id();
-            if cx.match_def_path(def_id, &paths::DEFAULT_TRAIT_METHOD);
+            if let Some(def_id) = cx.tables.qpath_res(qpath, path.hir_id).opt_def_id();
+            if match_def_path(cx, def_id, &paths::DEFAULT_TRAIT_METHOD);
             then {
                 match qpath {
                     QPath::Resolved(..) => {