RS.CLIPPY.LARGE_CONST_ARRAYS
Large non-scalar const array may cause performance overhead
This checker is a Clippy lint created by The Rust Project Contributors. The documentation shown here is a copy of the original documentation for: large_const_arrays. Copyright ©2025 The Rust Team. All rights reserved.
What it does
Checks for large const arrays that should
be defined as static instead.
Why is this bad?
Performance: const variables are inlined upon use. Static items result in only one instance and has a fixed location in memory.
Example
pub const a = [0u32; 1_000_000];
Use instead:
pub static a = [0u32; 1_000_000];
Configuration
-
array-size-threshold: The maximum allowed size for arrays on the stack(default:
16384)