mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-26 22:50:56 +00:00
22 lines
538 B
Rust
22 lines
538 B
Rust
#![warn(clippy::unnecessary_first_then_check)]
|
|
#![allow(clippy::useless_vec, clippy::const_is_empty)]
|
|
|
|
fn main() {
|
|
let s = [1, 2, 3];
|
|
let _: bool = !s.is_empty();
|
|
let _: bool = s.is_empty();
|
|
|
|
let v = vec![1, 2, 3];
|
|
let _: bool = !v.is_empty();
|
|
|
|
let n = [[1, 2, 3], [4, 5, 6]];
|
|
let _: bool = !n[0].is_empty();
|
|
let _: bool = n[0].is_empty();
|
|
|
|
struct Foo {
|
|
bar: &'static [i32],
|
|
}
|
|
let f = [Foo { bar: &[] }];
|
|
let _: bool = !f[0].bar.is_empty();
|
|
let _: bool = f[0].bar.is_empty();
|
|
}
|