Remove hir::ImplItem::attrs.

This commit is contained in:
Camille GILLOT 2020-11-27 09:55:10 +01:00
parent dd2af148cc
commit 49835d8abf
6 changed files with 11 additions and 7 deletions

View File

@ -353,7 +353,7 @@ impl<'tcx> LateLintPass<'tcx> for Attributes {
fn check_impl_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx ImplItem<'_>) {
if is_relevant_impl(cx, item) {
check_attrs(cx, item.span, item.ident.name, &item.attrs)
check_attrs(cx, item.span, item.ident.name, cx.tcx.hir().attrs(item.hir_id()))
}
}

View File

@ -260,7 +260,8 @@ impl<'tcx> LateLintPass<'tcx> for DocMarkdown {
}
fn check_impl_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx hir::ImplItem<'_>) {
let headers = check_attrs(cx, &self.valid_idents, &item.attrs);
let attrs = cx.tcx.hir().attrs(item.hir_id());
let headers = check_attrs(cx, &self.valid_idents, attrs);
if self.in_trait_impl || in_external_macro(cx.tcx.sess, item.span) {
return;
}

View File

@ -312,11 +312,12 @@ impl<'tcx> LateLintPass<'tcx> for Functions {
if is_public && trait_ref_of_method(cx, item.hir_id()).is_none() {
check_result_unit_err(cx, &sig.decl, item.span, fn_header_span);
}
let attr = must_use_attr(&item.attrs);
let attrs = cx.tcx.hir().attrs(item.hir_id());
let attr = must_use_attr(attrs);
if let Some(attr) = attr {
check_needless_must_use(cx, &sig.decl, item.hir_id(), item.span, fn_header_span, attr);
} else if is_public
&& !is_proc_macro(cx.sess(), &item.attrs)
&& !is_proc_macro(cx.sess(), attrs)
&& trait_ref_of_method(cx, item.hir_id()).is_none()
{
check_must_use_candidate(

View File

@ -183,7 +183,8 @@ impl<'tcx> LateLintPass<'tcx> for MissingDoc {
}
let (article, desc) = cx.tcx.article_and_description(impl_item.def_id.to_def_id());
self.check_missing_docs_attrs(cx, &impl_item.attrs, impl_item.span, article, desc);
let attrs = cx.tcx.hir().attrs(impl_item.hir_id());
self.check_missing_docs_attrs(cx, attrs, impl_item.span, article, desc);
}
fn check_struct_field(&mut self, cx: &LateContext<'tcx>, sf: &'tcx hir::StructField<'_>) {

View File

@ -161,6 +161,7 @@ impl<'tcx> LateLintPass<'tcx> for MissingInline {
}
}
check_missing_inline_attrs(cx, &impl_item.attrs, impl_item.span, desc);
let attrs = cx.tcx.hir().attrs(impl_item.hir_id());
check_missing_inline_attrs(cx, attrs, impl_item.span, desc);
}
}

View File

@ -40,7 +40,7 @@ impl<'tcx> LateLintPass<'tcx> for DeepCodeInspector {
}
fn check_impl_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx hir::ImplItem<'_>) {
if !has_attr(cx.sess(), &item.attrs) {
if !has_attr(cx.sess(), cx.tcx.hir().attrs(item.hir_id())) {
return;
}
println!("impl item `{}`", item.ident.name);