about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJason Newcomb <jsnewcomb@pm.me>2024-06-12 22:14:08 -0400
committerJason Newcomb <jsnewcomb@pm.me>2024-07-07 16:51:33 -0400
commit3092c8a5fd4d715dd58bd8f6843330c3aa8de768 (patch)
tree11b2857836427378201dd4d71330ed5ec58fb1f3
parent6b10b4360cbecf11131228d174e6922505b215a1 (diff)
downloadrust-3092c8a5fd4d715dd58bd8f6843330c3aa8de768.tar.gz
rust-3092c8a5fd4d715dd58bd8f6843330c3aa8de768.zip
`large_const_arrays`: Check HIR tree first.
-rw-r--r--clippy_lints/src/large_const_arrays.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/clippy_lints/src/large_const_arrays.rs b/clippy_lints/src/large_const_arrays.rs
index 7f8197c0cc0..b18ab625e60 100644
--- a/clippy_lints/src/large_const_arrays.rs
+++ b/clippy_lints/src/large_const_arrays.rs
@@ -46,12 +46,12 @@ impl_lint_pass!(LargeConstArrays => [LARGE_CONST_ARRAYS]);
 
 impl<'tcx> LateLintPass<'tcx> for LargeConstArrays {
     fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx Item<'_>) {
-        if !item.span.from_expansion()
-            && let ItemKind::Const(_, generics, _) = &item.kind
+        if let ItemKind::Const(_, generics, _) = &item.kind
             // Since static items may not have generics, skip generic const items.
             // FIXME(generic_const_items): I don't think checking `generics.hwcp` suffices as it
             // doesn't account for empty where-clauses that only consist of keyword `where` IINM.
             && generics.params.is_empty() && !generics.has_where_clause_predicates
+            && !item.span.from_expansion()
             && let ty = cx.tcx.type_of(item.owner_id).instantiate_identity()
             && let ty::Array(element_type, cst) = ty.kind()
             && let ConstKind::Value(_, ty::ValTree::Leaf(element_count)) = cst.kind()