mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-12-02 17:40:13 +00:00
Remove hir::ImplItem::attrs.
This commit is contained in:
parent
dd2af148cc
commit
49835d8abf
6 changed files with 11 additions and 7 deletions
|
@ -353,7 +353,7 @@ impl<'tcx> LateLintPass<'tcx> for Attributes {
|
||||||
|
|
||||||
fn check_impl_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx ImplItem<'_>) {
|
fn check_impl_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx ImplItem<'_>) {
|
||||||
if is_relevant_impl(cx, item) {
|
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()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -260,7 +260,8 @@ impl<'tcx> LateLintPass<'tcx> for DocMarkdown {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn check_impl_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx hir::ImplItem<'_>) {
|
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) {
|
if self.in_trait_impl || in_external_macro(cx.tcx.sess, item.span) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -312,11 +312,12 @@ impl<'tcx> LateLintPass<'tcx> for Functions {
|
||||||
if is_public && trait_ref_of_method(cx, item.hir_id()).is_none() {
|
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);
|
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 {
|
if let Some(attr) = attr {
|
||||||
check_needless_must_use(cx, &sig.decl, item.hir_id(), item.span, fn_header_span, attr);
|
check_needless_must_use(cx, &sig.decl, item.hir_id(), item.span, fn_header_span, attr);
|
||||||
} else if is_public
|
} 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()
|
&& trait_ref_of_method(cx, item.hir_id()).is_none()
|
||||||
{
|
{
|
||||||
check_must_use_candidate(
|
check_must_use_candidate(
|
||||||
|
|
|
@ -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());
|
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<'_>) {
|
fn check_struct_field(&mut self, cx: &LateContext<'tcx>, sf: &'tcx hir::StructField<'_>) {
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ impl<'tcx> LateLintPass<'tcx> for DeepCodeInspector {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn check_impl_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx hir::ImplItem<'_>) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
println!("impl item `{}`", item.ident.name);
|
println!("impl item `{}`", item.ident.name);
|
||||||
|
|
Loading…
Reference in a new issue