]> git.lizzy.rs Git - rust.git/blobdiff - clippy_lints/src/new_without_default.rs
Merge branch 'macro-use' into HEAD
[rust.git] / clippy_lints / src / new_without_default.rs
index adc91bacdef7ef2d1623453466012dc2ed9a962e..a21927102923c7350323e67d3d8ae25d5afa98ae 100644 (file)
@@ -1,6 +1,8 @@
 use rustc::hir::def_id::DefId;
 use rustc::hir;
 use rustc::lint::*;
+use rustc::{declare_lint, lint_array};
+use if_chain::if_chain;
 use rustc::ty::{self, Ty};
 use syntax::codemap::Span;
 use crate::utils::paths;
@@ -89,7 +91,7 @@ fn get_lints(&self) -> LintArray {
 
 impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NewWithoutDefault {
     fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx hir::Item) {
-        if let hir::ItemImpl(_, _, _, _, None, _, ref items) = item.node {
+        if let hir::ItemKind::Impl(_, _, _, _, None, _, ref items) = item.node {
             for assoc_item in items {
                 if let hir::AssociatedItemKind::Method { has_self: false } = assoc_item.kind {
                     let impl_item = cx.tcx.hir.impl_item(assoc_item.id);
@@ -97,7 +99,7 @@ fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx hir::Item) {
                         return;
                     }
                     if let hir::ImplItemKind::Method(ref sig, _) = impl_item.node {
-                        let name = impl_item.name;
+                        let name = impl_item.ident.name;
                         let id = impl_item.id;
                         if sig.header.constness == hir::Constness::Const {
                             // can't be implemented by default