rust-lang / rust-lang/rust-clippy

Suggestion: lower the default `array-size-threshold`/make `large_const_arrays` apply to all large consts

Open
#17,074 2 comments 0 reactions 1 assignee View on GitHub

@theirix is already working on this.

Since Jun 5, 2026.

A-ui L-perf
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.