2023-04-23 06:03:09 -05:00
|
|
|
//@run-rustfix
|
2020-11-05 07:29:48 -06:00
|
|
|
|
|
|
|
#![warn(clippy::comparison_to_empty)]
|
|
|
|
|
|
|
|
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];
|
|
|
|
}
|