//! 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.
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(_, _) => {
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
}
}
-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;
}