Skip to content

Commit 49835d8

Browse files
committed
Remove hir::ImplItem::attrs.
1 parent dd2af14 commit 49835d8

File tree

6 files changed

+11
-7
lines changed

6 files changed

+11
-7
lines changed

clippy_lints/src/attrs.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ impl<'tcx> LateLintPass<'tcx> for Attributes {
353353

354354
fn check_impl_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx ImplItem<'_>) {
355355
if is_relevant_impl(cx, item) {
356-
check_attrs(cx, item.span, item.ident.name, &item.attrs)
356+
check_attrs(cx, item.span, item.ident.name, cx.tcx.hir().attrs(item.hir_id()))
357357
}
358358
}
359359

clippy_lints/src/doc.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,8 @@ impl<'tcx> LateLintPass<'tcx> for DocMarkdown {
260260
}
261261

262262
fn check_impl_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx hir::ImplItem<'_>) {
263-
let headers = check_attrs(cx, &self.valid_idents, &item.attrs);
263+
let attrs = cx.tcx.hir().attrs(item.hir_id());
264+
let headers = check_attrs(cx, &self.valid_idents, attrs);
264265
if self.in_trait_impl || in_external_macro(cx.tcx.sess, item.span) {
265266
return;
266267
}

clippy_lints/src/functions.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -312,11 +312,12 @@ impl<'tcx> LateLintPass<'tcx> for Functions {
312312
if is_public && trait_ref_of_method(cx, item.hir_id()).is_none() {
313313
check_result_unit_err(cx, &sig.decl, item.span, fn_header_span);
314314
}
315-
let attr = must_use_attr(&item.attrs);
315+
let attrs = cx.tcx.hir().attrs(item.hir_id());
316+
let attr = must_use_attr(attrs);
316317
if let Some(attr) = attr {
317318
check_needless_must_use(cx, &sig.decl, item.hir_id(), item.span, fn_header_span, attr);
318319
} else if is_public
319-
&& !is_proc_macro(cx.sess(), &item.attrs)
320+
&& !is_proc_macro(cx.sess(), attrs)
320321
&& trait_ref_of_method(cx, item.hir_id()).is_none()
321322
{
322323
check_must_use_candidate(

clippy_lints/src/missing_doc.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,8 @@ impl<'tcx> LateLintPass<'tcx> for MissingDoc {
183183
}
184184

185185
let (article, desc) = cx.tcx.article_and_description(impl_item.def_id.to_def_id());
186-
self.check_missing_docs_attrs(cx, &impl_item.attrs, impl_item.span, article, desc);
186+
let attrs = cx.tcx.hir().attrs(impl_item.hir_id());
187+
self.check_missing_docs_attrs(cx, attrs, impl_item.span, article, desc);
187188
}
188189

189190
fn check_struct_field(&mut self, cx: &LateContext<'tcx>, sf: &'tcx hir::StructField<'_>) {

clippy_lints/src/missing_inline.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ impl<'tcx> LateLintPass<'tcx> for MissingInline {
161161
}
162162
}
163163

164-
check_missing_inline_attrs(cx, &impl_item.attrs, impl_item.span, desc);
164+
let attrs = cx.tcx.hir().attrs(impl_item.hir_id());
165+
check_missing_inline_attrs(cx, attrs, impl_item.span, desc);
165166
}
166167
}

clippy_lints/src/utils/inspector.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ impl<'tcx> LateLintPass<'tcx> for DeepCodeInspector {
4040
}
4141

4242
fn check_impl_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx hir::ImplItem<'_>) {
43-
if !has_attr(cx.sess(), &item.attrs) {
43+
if !has_attr(cx.sess(), cx.tcx.hir().attrs(item.hir_id())) {
4444
return;
4545
}
4646
println!("impl item `{}`", item.ident.name);

0 commit comments

Comments
 (0)