mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-14 17:07:17 +00:00
7a888968f9
for cleaner stderr file Co-Authored-By: Philipp Krones <hello@philkrones.com>
11 lines
257 B
Rust
11 lines
257 B
Rust
#![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]; // should trigger out of bounds error
|
|
&x[10..num]; // should trigger out of bounds error
|
|
}
|