Skip to content

Commit 37326f5

Browse files
Giorgio Gambinolukasstevens
Giorgio Gambino
authored andcommitted
Fix issue rust-lang#3322: reword help message for len_zero
1 parent d50ca21 commit 37326f5

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

clippy_lints/src/len_zero.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ fn check_len(cx: &LateContext<'_, '_>, span: Span, method_name: Name, args: &[Ex
240240
LEN_ZERO,
241241
span,
242242
&format!("length comparison to {}", if compare_to == 0 { "zero" } else { "one" }),
243-
"using `is_empty` is more concise",
243+
"using `is_empty` is clearer and more explicit",
244244
format!("{}{}.is_empty()", op, snippet(cx, args[0].span, "_")),
245245
);
246246
}

tests/ui/len_zero.stderr

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -46,87 +46,87 @@ error: length comparison to zero
4646
--> $DIR/len_zero.rs:151:8
4747
|
4848
151 | if x.len() == 0 {
49-
| ^^^^^^^^^^^^ help: using `is_empty` is more concise: `x.is_empty()`
49+
| ^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `x.is_empty()`
5050
|
5151
= note: `-D clippy::len-zero` implied by `-D warnings`
5252

5353
error: length comparison to zero
5454
--> $DIR/len_zero.rs:155:8
5555
|
5656
155 | if "".len() == 0 {}
57-
| ^^^^^^^^^^^^^ help: using `is_empty` is more concise: `"".is_empty()`
57+
| ^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `"".is_empty()`
5858

5959
error: length comparison to zero
6060
--> $DIR/len_zero.rs:170:8
6161
|
6262
170 | if has_is_empty.len() == 0 {
63-
| ^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is more concise: `has_is_empty.is_empty()`
63+
| ^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `has_is_empty.is_empty()`
6464

6565
error: length comparison to zero
6666
--> $DIR/len_zero.rs:173:8
6767
|
6868
173 | if has_is_empty.len() != 0 {
69-
| ^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is more concise: `!has_is_empty.is_empty()`
69+
| ^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `!has_is_empty.is_empty()`
7070

7171
error: length comparison to zero
7272
--> $DIR/len_zero.rs:176:8
7373
|
7474
176 | if has_is_empty.len() > 0 {
75-
| ^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is more concise: `!has_is_empty.is_empty()`
75+
| ^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `!has_is_empty.is_empty()`
7676

7777
error: length comparison to one
7878
--> $DIR/len_zero.rs:179:8
7979
|
8080
179 | if has_is_empty.len() < 1 {
81-
| ^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is more concise: `has_is_empty.is_empty()`
81+
| ^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `has_is_empty.is_empty()`
8282

8383
error: length comparison to one
8484
--> $DIR/len_zero.rs:182:8
8585
|
8686
182 | if has_is_empty.len() >= 1 {
87-
| ^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is more concise: `!has_is_empty.is_empty()`
87+
| ^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `!has_is_empty.is_empty()`
8888

8989
error: length comparison to zero
9090
--> $DIR/len_zero.rs:193:8
9191
|
9292
193 | if 0 == has_is_empty.len() {
93-
| ^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is more concise: `has_is_empty.is_empty()`
93+
| ^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `has_is_empty.is_empty()`
9494

9595
error: length comparison to zero
9696
--> $DIR/len_zero.rs:196:8
9797
|
9898
196 | if 0 != has_is_empty.len() {
99-
| ^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is more concise: `!has_is_empty.is_empty()`
99+
| ^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `!has_is_empty.is_empty()`
100100

101101
error: length comparison to zero
102102
--> $DIR/len_zero.rs:199:8
103103
|
104104
199 | if 0 < has_is_empty.len() {
105-
| ^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is more concise: `!has_is_empty.is_empty()`
105+
| ^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `!has_is_empty.is_empty()`
106106

107107
error: length comparison to one
108108
--> $DIR/len_zero.rs:202:8
109109
|
110110
202 | if 1 <= has_is_empty.len() {
111-
| ^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is more concise: `!has_is_empty.is_empty()`
111+
| ^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `!has_is_empty.is_empty()`
112112

113113
error: length comparison to one
114114
--> $DIR/len_zero.rs:205:8
115115
|
116116
205 | if 1 > has_is_empty.len() {
117-
| ^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is more concise: `has_is_empty.is_empty()`
117+
| ^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `has_is_empty.is_empty()`
118118

119119
error: length comparison to zero
120120
--> $DIR/len_zero.rs:219:8
121121
|
122122
219 | if with_is_empty.len() == 0 {
123-
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is more concise: `with_is_empty.is_empty()`
123+
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `with_is_empty.is_empty()`
124124

125125
error: length comparison to zero
126126
--> $DIR/len_zero.rs:232:8
127127
|
128128
232 | if b.len() != 0 {}
129-
| ^^^^^^^^^^^^ help: using `is_empty` is more concise: `!b.is_empty()`
129+
| ^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `!b.is_empty()`
130130

131131
error: trait `DependsOnFoo` has a `len` method but no (possibly inherited) `is_empty` method
132132
--> $DIR/len_zero.rs:238:1

0 commit comments

Comments
 (0)