fn main() {
let x = [1, 2];
if x.len() == 0 {
-
-
-
println!("This should not happen!");
}
if "".len() == 0 {
-
-
-
}
let y = One;
let has_is_empty = HasIsEmpty;
if has_is_empty.len() == 0 {
-
-
-
println!("Or this!");
}
if has_is_empty.len() != 0 {
-
-
-
println!("Or this!");
}
if has_is_empty.len() > 0 {
-
-
-
println!("Or this!");
}
assert!(!has_is_empty.is_empty());
let with_is_empty: &WithIsEmpty = &Wither;
if with_is_empty.len() == 0 {
-
-
-
println!("Or this!");
}
assert!(!with_is_empty.is_empty());
| ^^^^^^^^
error: length comparison to zero
- --> $DIR/len_zero.rs:137:8
+ --> $DIR/len_zero.rs:134:8
|
-137 | if "".len() == 0 {
+134 | if "".len() == 0 {
| ^^^^^^^^^^^^^ help: using `is_empty` is more concise: `"".is_empty()`
error: length comparison to zero
- --> $DIR/len_zero.rs:154:8
+ --> $DIR/len_zero.rs:148:8
|
-154 | if has_is_empty.len() == 0 {
+148 | if has_is_empty.len() == 0 {
| ^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is more concise: `has_is_empty.is_empty()`
error: length comparison to zero
- --> $DIR/len_zero.rs:160:8
+ --> $DIR/len_zero.rs:151:8
|
-160 | if has_is_empty.len() != 0 {
+151 | if has_is_empty.len() != 0 {
| ^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is more concise: `!has_is_empty.is_empty()`
error: length comparison to zero
- --> $DIR/len_zero.rs:166:8
+ --> $DIR/len_zero.rs:154:8
|
-166 | if has_is_empty.len() > 0 {
+154 | if has_is_empty.len() > 0 {
| ^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is more concise: `!has_is_empty.is_empty()`
error: length comparison to zero
- --> $DIR/len_zero.rs:175:8
+ --> $DIR/len_zero.rs:160:8
|
-175 | if with_is_empty.len() == 0 {
+160 | if with_is_empty.len() == 0 {
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is more concise: `with_is_empty.is_empty()`
error: length comparison to zero
- --> $DIR/len_zero.rs:190:8
+ --> $DIR/len_zero.rs:172:8
|
-190 | if b.len() != 0 {
+172 | if b.len() != 0 {
| ^^^^^^^^^^^^ help: using `is_empty` is more concise: `!b.is_empty()`
error: aborting due to 11 previous errors