Skip to content

Commit 3092c8a

Browse files
committed
large_const_arrays: Check HIR tree first.
1 parent 6b10b43 commit 3092c8a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

clippy_lints/src/large_const_arrays.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@ impl_lint_pass!(LargeConstArrays => [LARGE_CONST_ARRAYS]);
4646

4747
impl<'tcx> LateLintPass<'tcx> for LargeConstArrays {
4848
fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx Item<'_>) {
49-
if !item.span.from_expansion()
50-
&& let ItemKind::Const(_, generics, _) = &item.kind
49+
if let ItemKind::Const(_, generics, _) = &item.kind
5150
// Since static items may not have generics, skip generic const items.
5251
// FIXME(generic_const_items): I don't think checking `generics.hwcp` suffices as it
5352
// doesn't account for empty where-clauses that only consist of keyword `where` IINM.
5453
&& generics.params.is_empty() && !generics.has_where_clause_predicates
54+
&& !item.span.from_expansion()
5555
&& let ty = cx.tcx.type_of(item.owner_id).instantiate_identity()
5656
&& let ty::Array(element_type, cst) = ty.kind()
5757
&& let ConstKind::Value(_, ty::ValTree::Leaf(element_count)) = cst.kind()

0 commit comments

Comments
 (0)