]>
Commit | Line | Data |
---|---|---|
f20569fa XL |
1 | // run-rustfix |
2 | ||
3 | #![warn(clippy::large_const_arrays)] | |
4 | #![allow(dead_code)] | |
5 | ||
6 | #[derive(Clone, Copy)] | |
7 | pub struct S { | |
8 | pub data: [u64; 32], | |
9 | } | |
10 | ||
11 | // Should lint | |
12 | pub(crate) static FOO_PUB_CRATE: [u32; 1_000_000] = [0u32; 1_000_000]; | |
13 | pub static FOO_PUB: [u32; 1_000_000] = [0u32; 1_000_000]; | |
14 | static FOO: [u32; 1_000_000] = [0u32; 1_000_000]; | |
15 | ||
16 | // Good | |
17 | pub(crate) const G_FOO_PUB_CRATE: [u32; 1_000] = [0u32; 1_000]; | |
18 | pub const G_FOO_PUB: [u32; 1_000] = [0u32; 1_000]; | |
19 | const G_FOO: [u32; 1_000] = [0u32; 1_000]; | |
20 | ||
21 | fn main() { | |
22 | // Should lint | |
23 | pub static BAR_PUB: [u32; 1_000_000] = [0u32; 1_000_000]; | |
24 | static BAR: [u32; 1_000_000] = [0u32; 1_000_000]; | |
25 | pub static BAR_STRUCT_PUB: [S; 5_000] = [S { data: [0; 32] }; 5_000]; | |
26 | static BAR_STRUCT: [S; 5_000] = [S { data: [0; 32] }; 5_000]; | |
27 | pub static BAR_S_PUB: [Option<&str>; 200_000] = [Some("str"); 200_000]; | |
28 | static BAR_S: [Option<&str>; 200_000] = [Some("str"); 200_000]; | |
29 | ||
30 | // Good | |
31 | pub const G_BAR_PUB: [u32; 1_000] = [0u32; 1_000]; | |
32 | const G_BAR: [u32; 1_000] = [0u32; 1_000]; | |
33 | pub const G_BAR_STRUCT_PUB: [S; 500] = [S { data: [0; 32] }; 500]; | |
34 | const G_BAR_STRUCT: [S; 500] = [S { data: [0; 32] }; 500]; | |
35 | pub const G_BAR_S_PUB: [Option<&str>; 200] = [Some("str"); 200]; | |
36 | const G_BAR_S: [Option<&str>; 200] = [Some("str"); 200]; | |
37 | } |