1 #![warn(clippy::indexing_slicing)]
2 // We also check the out_of_bounds_indexing lint here, because it lints similar things and
3 // we want to avoid false positives.
4 #![warn(clippy::out_of_bounds_indexing)]
5 #![allow(clippy::no_effect, clippy::unnecessary_operation)]
11 x[4]; // Ok, let rustc's `const_err` lint handle `usize` indexing on arrays.
12 x[1 << 3]; // Ok, let rustc's `const_err` lint handle `usize` indexing on arrays.
14 x[0]; // Ok, should not produce stderr.
15 x[3]; // Ok, should not produce stderr.
18 y[0]; // Ok, referencing shouldn't affect this lint. See the issue 6021
19 y[4]; // Ok, rustc will handle references too.
26 const N: usize = 15; // Out of bounds
27 const M: usize = 3; // In bounds
28 x[N]; // Ok, let rustc's `const_err` lint handle `usize` indexing on arrays.
29 x[M]; // Ok, should not produce stderr.