]> git.lizzy.rs Git - rust.git/blobdiff - clippy_lints/src/exhaustive_items.rs
Rollup merge of #82917 - cuviper:iter-zip, r=m-ou-se
[rust.git] / clippy_lints / src / exhaustive_items.rs
index e3988d0038c23b8f2e187afad6d3836c62a049fc..60ad2e8ee1404fec06b5b71a5b9bc68c96a11b02 100644 (file)
@@ -1,4 +1,5 @@
-use crate::utils::{indent_of, span_lint_and_then};
+use clippy_utils::diagnostics::span_lint_and_then;
+use clippy_utils::source::indent_of;
 use if_chain::if_chain;
 use rustc_errors::Applicability;
 use rustc_hir::{Item, ItemKind};
@@ -72,8 +73,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()) {