]> git.lizzy.rs Git - rust.git/blobdiff - clippy_lints/src/exhaustive_items.rs
Rollup merge of #83092 - petrochenkov:qspan, r=estebank
[rust.git] / clippy_lints / src / exhaustive_items.rs
index e3988d0038c23b8f2e187afad6d3836c62a049fc..316f7484862803281cdcc2f96e9b3a06d5c87beb 100644 (file)
@@ -72,8 +72,9 @@ impl LateLintPass<'_> for ExhaustiveItems {
     fn check_item(&mut self, cx: &LateContext<'_>, item: &Item<'_>) {
         if_chain! {
             if let ItemKind::Enum(..) | ItemKind::Struct(..) = item.kind;
-            if cx.access_levels.is_exported(item.hir_id);
-            if !item.attrs.iter().any(|a| a.has_name(sym::non_exhaustive));
+            if cx.access_levels.is_exported(item.hir_id());
+            let attrs = cx.tcx.hir().attrs(item.hir_id());
+            if !attrs.iter().any(|a| a.has_name(sym::non_exhaustive));
             then {
                 let (lint, msg) = if let ItemKind::Struct(ref v, ..) = item.kind {
                     if v.fields().iter().any(|f| !f.vis.node.is_pub()) {