mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-27 15:11:30 +00:00
65e9477b84
Co-Authored-By: Philipp Krones <hello@philkrones.com>
19 lines
490 B
Rust
19 lines
490 B
Rust
#![warn(clippy::out_of_bounds_indexing)]
|
|
#![allow(clippy::no_effect, clippy::unnecessary_operation)]
|
|
|
|
fn main() {
|
|
let empty: [i8; 0] = [];
|
|
empty[0];
|
|
&empty[1..5];
|
|
&empty[0..=4];
|
|
&empty[..=4];
|
|
&empty[1..];
|
|
&empty[..4];
|
|
&empty[0..=0];
|
|
&empty[..=0];
|
|
|
|
&empty[0..]; // Ok, should not produce stderr.
|
|
&empty[0..0]; // Ok, should not produce stderr.
|
|
&empty[..0]; // Ok, should not produce stderr.
|
|
&empty[..]; // Ok, should not produce stderr.
|
|
}
|