]> git.lizzy.rs Git - rust.git/blobdiff - clippy_lints/src/attrs.rs
Rustup
[rust.git] / clippy_lints / src / attrs.rs
index 936b5e75ff64982d63e0d3ee8a096478b248ca2c..b9d8976b28b4f0ce72face771ca2f1b5b3021df2 100644 (file)
@@ -1,16 +1,16 @@
 //! checks for attributes
 
-use reexport::*;
+use crate::reexport::*;
+use crate::utils::{
+    in_macro, last_line_of_span, match_def_path, opt_def_id, paths, snippet_opt, span_lint, span_lint_and_then,
+    without_block_comments,
+};
 use rustc::hir::*;
 use rustc::lint::*;
 use rustc::ty::{self, TyCtxt};
 use semver::Version;
 use syntax::ast::{AttrStyle, Attribute, Lit, LitKind, MetaItemKind, NestedMetaItem, NestedMetaItemKind};
 use syntax::codemap::Span;
-use utils::{
-    in_macro, last_line_of_span, match_def_path, opt_def_id, paths, snippet_opt, span_lint, span_lint_and_then,
-    without_block_comments,
-};
 
 /// **What it does:** Checks for items annotated with `#[inline(always)]`,
 /// unless the annotated function is empty or simply panics.
@@ -151,7 +151,7 @@ fn check_attribute(&mut self, cx: &LateContext<'a, 'tcx>, attr: &'tcx Attribute)
 
     fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) {
         if is_relevant_item(cx.tcx, item) {
-            check_attrs(cx, item.span, &item.name, &item.attrs)
+            check_attrs(cx, item.span, item.name, &item.attrs)
         }
         match item.node {
             ItemExternCrate(_) | ItemUse(_, _) => {
@@ -195,19 +195,19 @@ fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) {
 
     fn check_impl_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx ImplItem) {
         if is_relevant_impl(cx.tcx, item) {
-            check_attrs(cx, item.span, &item.name, &item.attrs)
+            check_attrs(cx, item.span, item.ident.name, &item.attrs)
         }
     }
 
     fn check_trait_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx TraitItem) {
         if is_relevant_trait(cx.tcx, item) {
-            check_attrs(cx, item.span, &item.name, &item.attrs)
+            check_attrs(cx, item.span, item.ident.name, &item.attrs)
         }
     }
 }
 
 fn is_relevant_item(tcx: TyCtxt, item: &Item) -> bool {
-    if let ItemFn(_, _, _, _, _, eid) = item.node {
+    if let ItemFn(_, _, _, eid) = item.node {
         is_relevant_expr(tcx, tcx.body_tables(eid), &tcx.hir.body(eid).value)
     } else {
         true
@@ -260,7 +260,7 @@ fn is_relevant_expr(tcx: TyCtxt, tables: &ty::TypeckTables, expr: &Expr) -> bool
     }
 }
 
-fn check_attrs(cx: &LateContext, span: Span, name: &Name, attrs: &[Attribute]) {
+fn check_attrs(cx: &LateContext, span: Span, name: Name, attrs: &[Attribute]) {
     if in_macro(span) {
         return;
     }