2023-04-20 09:37:15 -05:00
|
|
|
//@run-rustfix
|
2020-10-25 18:31:25 -05:00
|
|
|
|
|
|
|
#![warn(clippy::comparison_to_empty)]
|
2023-06-06 15:56:57 -05:00
|
|
|
#![allow(clippy::useless_vec)]
|
2020-10-25 18:31:25 -05:00
|
|
|
|
|
|
|
fn main() {
|
|
|
|
// Disallow comparisons to empty
|
|
|
|
let s = String::new();
|
|
|
|
let _ = s == "";
|
|
|
|
let _ = s != "";
|
|
|
|
|
|
|
|
let v = vec![0];
|
|
|
|
let _ = v == [];
|
|
|
|
let _ = v != [];
|
|
|
|
|
|
|
|
// Allow comparisons to non-empty
|
|
|
|
let s = String::new();
|
|
|
|
let _ = s == " ";
|
|
|
|
let _ = s != " ";
|
|
|
|
|
|
|
|
let v = vec![0];
|
|
|
|
let _ = v == [0];
|
|
|
|
let _ = v != [0];
|
|
|
|
}
|