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)]
10 let index_from: usize = 2;
11 let index_to: usize = 3;
14 &x[index_from..index_to];
15 &x[index_from..][..index_to]; // Two lint reports, one for [index_from..] and another for [..index_to].
16 &x[5..][..10]; // Two lint reports, one for out of bounds [5..] and another for slicing [..10].
20 &x[0..].get(..3); // Ok, should not produce stderr.
21 &x[0..3]; // Ok, should not produce stderr.
28 &y[..]; // Ok, should not produce stderr.
32 &x[10..][..100]; // Two lint reports, one for [10..] and another for [..100].
36 &v[..]; // Ok, should not produce stderr.