rust-lang / rust-lang/rust-clippy
Suggestion: lower the default `array-size-threshold`/make `large_const_arrays` apply to all large consts
@theirix is already working on this.
Since Jun 5, 2026.
- Dominant language
- Rust
- Stars
- 13.5k
- Forks
- 2.2k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 32
Description
I've been looking into performance issues with debug builds of Symphonia, and it seems it's largely caused by indexing a large lookup table (const [f32; 512]) in a loop, which causes the entire table to be copied each iteration.
This would have been caught earlier by clippy::large_const_arrays if the default threshold was lower.
I see 162 projects on github using array-size-threshold<1kB, indicating that a lot of people prefer to use a smaller threshold.
Lowering the default might cause the clippy::large_stack_arrays lint to be triggered more often, so it might be a good idea to have a different threshold for each lint.
Also, would it make sense for large_const_arrays to lint all consts larger than array-size-threshold? Because currently, this is caught:
pub const a: [u32; 1_000_000] = [0u32; 1_000_000];
but not this:
pub const a: ([u32; 1_000_000],) = ([0u32; 1_000_000],);
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.