about summary refs log tree commit diff
path: root/src/tools/clippy/tests/ui/out_of_bounds_indexing/issue-3102.rs
blob: e1e0fa02a9371acb5cd3b38ddc24c551a8b37137 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#![warn(clippy::out_of_bounds_indexing)]
#![allow(clippy::no_effect)]

fn main() {
    let x = [1, 2, 3, 4];

    // issue 3102
    let num = 1;
    &x[num..10];
    //~^ out_of_bounds_indexing

    &x[10..num];
    //~^ out_of_bounds_indexing
}