Closed
Description
Summary
The clippy lint large_stack_arrays
only checks expressions in the form [expr; n]
, and it doesn't detect large arrays declared as a comma-separated list of initializers.
Lint Name
large_stack_arrays
Reproducer
I tried this code, with the default array-size-threshold = 512000
:
#[derive(Copy, Clone)]
struct Large([u32; 100_000]);
fn build() -> Large { Large([0; 100_000]) }
#[warn(clippy::large_stack_arrays)]
pub fn f() {
// warning on this line
let _x = [build(); 3];
// missing warning on this line
let _y = [build(), build(), build()];
}
Version
rustc 1.68.2 (9eb3afe9e 2023-03-27)
binary: rustc
commit-hash: 9eb3afe9ebe9c7d2b84b71002d44f4a0edac95e0
commit-date: 2023-03-27
host: x86_64-apple-darwin
release: 1.68.2
LLVM version: 15.0.6