Skip to content

Commit e00b1cc

Browse files
committed
change some lint messages and remove old entries from the ignorelist
1 parent e107b65 commit e00b1cc

File tree

7 files changed

+43
-47
lines changed

7 files changed

+43
-47
lines changed

clippy_lints/src/methods/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2569,7 +2569,7 @@ fn lint_step_by<'tcx>(cx: &LateContext<'tcx>, expr: &hir::Expr<'_>, args: &'tcx
25692569
cx,
25702570
ITERATOR_STEP_BY_ZERO,
25712571
expr.span,
2572-
"Iterator::step_by(0) will panic at runtime",
2572+
"`Iterator::step_by(0)` will panic at runtime",
25732573
);
25742574
}
25752575
}

clippy_lints/src/suspicious_operation_groupings.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ fn emit_suggestion(cx: &EarlyContext<'_>, span: Span, sugg: String, applicabilit
262262
SUSPICIOUS_OPERATION_GROUPINGS,
263263
span,
264264
"this sequence of operators looks suspiciously like a bug",
265-
"I think you meant",
265+
"did you mean",
266266
sugg,
267267
applicability,
268268
)

clippy_lints/src/types.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,7 @@ impl Types {
578578
cx,
579579
LINKEDLIST,
580580
hir_ty.span,
581-
"I see you're using a LinkedList! Perhaps you meant some other data structure?",
581+
"you seem to be using a `LinkedList`! Perhaps you meant some other data structure?",
582582
None,
583583
"a `VecDeque` might work",
584584
);

tests/lint_message_convention.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,14 @@ impl Message {
3131
// sometimes the first character is capitalized and it is legal (like in "Iterator...") or
3232
// we want to ask a question ending in "?"
3333
let exceptions_set: RegexSet = RegexSet::new(&[
34-
r".*error: I see you're using a LinkedList! Perhaps you meant some other data structure?",
3534
r".*C-like enum variant discriminant is not portable to 32-bit targets",
36-
r".*Iterator::step_by(0) will panic at runtime",
3735
r".*did you mean `unix`?",
3836
r".*the arguments may be inverted...",
3937
r".*Intel x86 assembly syntax used",
4038
r".*AT&T x86 assembly syntax used",
4139
r".*remove .*the return type...",
4240
r"note: Clippy version: .*",
4341
r"the compiler unexpectedly panicked. this is a bug.",
44-
r".*help: I think you meant: .*",
45-
r"Iterator.* will panic at runtime",
4642
])
4743
.unwrap();
4844

tests/ui/dlist.stderr

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: I see you're using a LinkedList! Perhaps you meant some other data structure?
1+
error: you seem to be using a `LinkedList`! Perhaps you meant some other data structure?
22
--> $DIR/dlist.rs:9:16
33
|
44
LL | type Baz = LinkedList<u8>;
@@ -7,39 +7,39 @@ LL | type Baz = LinkedList<u8>;
77
= note: `-D clippy::linkedlist` implied by `-D warnings`
88
= help: a `VecDeque` might work
99

10-
error: I see you're using a LinkedList! Perhaps you meant some other data structure?
10+
error: you seem to be using a `LinkedList`! Perhaps you meant some other data structure?
1111
--> $DIR/dlist.rs:10:15
1212
|
1313
LL | fn foo(_: LinkedList<u8>);
1414
| ^^^^^^^^^^^^^^
1515
|
1616
= help: a `VecDeque` might work
1717

18-
error: I see you're using a LinkedList! Perhaps you meant some other data structure?
18+
error: you seem to be using a `LinkedList`! Perhaps you meant some other data structure?
1919
--> $DIR/dlist.rs:11:23
2020
|
2121
LL | const BAR: Option<LinkedList<u8>>;
2222
| ^^^^^^^^^^^^^^
2323
|
2424
= help: a `VecDeque` might work
2525

26-
error: I see you're using a LinkedList! Perhaps you meant some other data structure?
26+
error: you seem to be using a `LinkedList`! Perhaps you meant some other data structure?
2727
--> $DIR/dlist.rs:22:15
2828
|
2929
LL | fn foo(_: LinkedList<u8>) {}
3030
| ^^^^^^^^^^^^^^
3131
|
3232
= help: a `VecDeque` might work
3333

34-
error: I see you're using a LinkedList! Perhaps you meant some other data structure?
34+
error: you seem to be using a `LinkedList`! Perhaps you meant some other data structure?
3535
--> $DIR/dlist.rs:25:39
3636
|
3737
LL | pub fn test(my_favourite_linked_list: LinkedList<u8>) {
3838
| ^^^^^^^^^^^^^^
3939
|
4040
= help: a `VecDeque` might work
4141

42-
error: I see you're using a LinkedList! Perhaps you meant some other data structure?
42+
error: you seem to be using a `LinkedList`! Perhaps you meant some other data structure?
4343
--> $DIR/dlist.rs:29:29
4444
|
4545
LL | pub fn test_ret() -> Option<LinkedList<u8>> {

tests/ui/iterator_step_by_zero.stderr

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,42 @@
1-
error: Iterator::step_by(0) will panic at runtime
1+
error: `Iterator::step_by(0)` will panic at runtime
22
--> $DIR/iterator_step_by_zero.rs:3:13
33
|
44
LL | let _ = vec!["A", "B", "B"].iter().step_by(0);
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66
|
77
= note: `-D clippy::iterator-step-by-zero` implied by `-D warnings`
88

9-
error: Iterator::step_by(0) will panic at runtime
9+
error: `Iterator::step_by(0)` will panic at runtime
1010
--> $DIR/iterator_step_by_zero.rs:4:13
1111
|
1212
LL | let _ = "XXX".chars().step_by(0);
1313
| ^^^^^^^^^^^^^^^^^^^^^^^^
1414

15-
error: Iterator::step_by(0) will panic at runtime
15+
error: `Iterator::step_by(0)` will panic at runtime
1616
--> $DIR/iterator_step_by_zero.rs:5:13
1717
|
1818
LL | let _ = (0..1).step_by(0);
1919
| ^^^^^^^^^^^^^^^^^
2020

21-
error: Iterator::step_by(0) will panic at runtime
21+
error: `Iterator::step_by(0)` will panic at runtime
2222
--> $DIR/iterator_step_by_zero.rs:14:13
2323
|
2424
LL | let _ = (1..).step_by(0);
2525
| ^^^^^^^^^^^^^^^^
2626

27-
error: Iterator::step_by(0) will panic at runtime
27+
error: `Iterator::step_by(0)` will panic at runtime
2828
--> $DIR/iterator_step_by_zero.rs:15:13
2929
|
3030
LL | let _ = (1..=2).step_by(0);
3131
| ^^^^^^^^^^^^^^^^^^
3232

33-
error: Iterator::step_by(0) will panic at runtime
33+
error: `Iterator::step_by(0)` will panic at runtime
3434
--> $DIR/iterator_step_by_zero.rs:18:13
3535
|
3636
LL | let _ = x.step_by(0);
3737
| ^^^^^^^^^^^^
3838

39-
error: Iterator::step_by(0) will panic at runtime
39+
error: `Iterator::step_by(0)` will panic at runtime
4040
--> $DIR/iterator_step_by_zero.rs:22:13
4141
|
4242
LL | let _ = v1.iter().step_by(2 / 3);

tests/ui/suspicious_operation_groupings.stderr

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,165 +2,165 @@ error: this sequence of operators looks suspiciously like a bug
22
--> $DIR/suspicious_operation_groupings.rs:14:9
33
|
44
LL | self.x == other.y && self.y == other.y && self.z == other.z
5-
| ^^^^^^^^^^^^^^^^^ help: I think you meant: `self.x == other.x`
5+
| ^^^^^^^^^^^^^^^^^ help: did you mean: `self.x == other.x`
66
|
77
= note: `-D clippy::suspicious-operation-groupings` implied by `-D warnings`
88

99
error: this sequence of operators looks suspiciously like a bug
1010
--> $DIR/suspicious_operation_groupings.rs:14:9
1111
|
1212
LL | self.x == other.y && self.y == other.y && self.z == other.z
13-
| ^^^^^^^^^^^^^^^^^ help: I think you meant: `self.x == other.x`
13+
| ^^^^^^^^^^^^^^^^^ help: did you mean: `self.x == other.x`
1414

1515
error: this sequence of operators looks suspiciously like a bug
1616
--> $DIR/suspicious_operation_groupings.rs:27:20
1717
|
1818
LL | s1.a < s2.a && s1.a < s2.b
19-
| ^^^^^^^^^^^ help: I think you meant: `s1.b < s2.b`
19+
| ^^^^^^^^^^^ help: did you mean: `s1.b < s2.b`
2020

2121
error: this sequence of operators looks suspiciously like a bug
2222
--> $DIR/suspicious_operation_groupings.rs:75:33
2323
|
2424
LL | s1.a * s2.a + s1.b * s2.b + s1.c * s2.b + s1.d * s2.d
25-
| ^^^^^^^^^^^ help: I think you meant: `s1.c * s2.c`
25+
| ^^^^^^^^^^^ help: did you mean: `s1.c * s2.c`
2626

2727
error: this sequence of operators looks suspiciously like a bug
2828
--> $DIR/suspicious_operation_groupings.rs:80:19
2929
|
3030
LL | s1.a * s2.a + s1.b * s2.c + s1.c * s2.c
31-
| ^^^^^^^^^^^ help: I think you meant: `s1.b * s2.b`
31+
| ^^^^^^^^^^^ help: did you mean: `s1.b * s2.b`
3232

3333
error: this sequence of operators looks suspiciously like a bug
3434
--> $DIR/suspicious_operation_groupings.rs:80:19
3535
|
3636
LL | s1.a * s2.a + s1.b * s2.c + s1.c * s2.c
37-
| ^^^^^^^^^^^ help: I think you meant: `s1.b * s2.b`
37+
| ^^^^^^^^^^^ help: did you mean: `s1.b * s2.b`
3838

3939
error: this sequence of operators looks suspiciously like a bug
4040
--> $DIR/suspicious_operation_groupings.rs:85:19
4141
|
4242
LL | s1.a * s2.a + s2.b * s2.b + s1.c * s2.c
43-
| ^^^^^^^^^^^ help: I think you meant: `s1.b * s2.b`
43+
| ^^^^^^^^^^^ help: did you mean: `s1.b * s2.b`
4444

4545
error: this sequence of operators looks suspiciously like a bug
4646
--> $DIR/suspicious_operation_groupings.rs:90:19
4747
|
4848
LL | s1.a * s2.a + s1.b * s1.b + s1.c * s2.c
49-
| ^^^^^^^^^^^ help: I think you meant: `s1.b * s2.b`
49+
| ^^^^^^^^^^^ help: did you mean: `s1.b * s2.b`
5050

5151
error: this sequence of operators looks suspiciously like a bug
5252
--> $DIR/suspicious_operation_groupings.rs:95:5
5353
|
5454
LL | s1.a * s1.a + s1.b * s2.b + s1.c * s2.c
55-
| ^^^^^^^^^^^ help: I think you meant: `s1.a * s2.a`
55+
| ^^^^^^^^^^^ help: did you mean: `s1.a * s2.a`
5656

5757
error: this sequence of operators looks suspiciously like a bug
5858
--> $DIR/suspicious_operation_groupings.rs:100:33
5959
|
6060
LL | s1.a * s2.a + s1.b * s2.b + s1.c * s1.c
61-
| ^^^^^^^^^^^ help: I think you meant: `s1.c * s2.c`
61+
| ^^^^^^^^^^^ help: did you mean: `s1.c * s2.c`
6262

6363
error: this sequence of operators looks suspiciously like a bug
6464
--> $DIR/suspicious_operation_groupings.rs:113:20
6565
|
6666
LL | (s1.a * s2.a + s1.b * s1.b)
67-
| ^^^^^^^^^^^ help: I think you meant: `s1.b * s2.b`
67+
| ^^^^^^^^^^^ help: did you mean: `s1.b * s2.b`
6868

6969
error: this sequence of operators looks suspiciously like a bug
7070
--> $DIR/suspicious_operation_groupings.rs:118:34
7171
|
7272
LL | (s1.a * s2.a + s1.b * s2.b + s1.c * s2.b + s1.d * s2.d)
73-
| ^^^^^^^^^^^ help: I think you meant: `s1.c * s2.c`
73+
| ^^^^^^^^^^^ help: did you mean: `s1.c * s2.c`
7474

7575
error: this sequence of operators looks suspiciously like a bug
7676
--> $DIR/suspicious_operation_groupings.rs:123:38
7777
|
7878
LL | (s1.a * s2.a) + (s1.b * s2.b) + (s1.c * s2.b) + (s1.d * s2.d)
79-
| ^^^^^^^^^^^ help: I think you meant: `s1.c * s2.c`
79+
| ^^^^^^^^^^^ help: did you mean: `s1.c * s2.c`
8080

8181
error: this sequence of operators looks suspiciously like a bug
8282
--> $DIR/suspicious_operation_groupings.rs:128:39
8383
|
8484
LL | ((s1.a * s2.a) + (s1.b * s2.b) + (s1.c * s2.b) + (s1.d * s2.d))
85-
| ^^^^^^^^^^^ help: I think you meant: `s1.c * s2.c`
85+
| ^^^^^^^^^^^ help: did you mean: `s1.c * s2.c`
8686

8787
error: this sequence of operators looks suspiciously like a bug
8888
--> $DIR/suspicious_operation_groupings.rs:133:42
8989
|
9090
LL | (((s1.a * s2.a) + (s1.b * s2.b)) + ((s1.c * s2.b) + (s1.d * s2.d)))
91-
| ^^^^^^^^^^^ help: I think you meant: `s1.c * s2.c`
91+
| ^^^^^^^^^^^ help: did you mean: `s1.c * s2.c`
9292

9393
error: this sequence of operators looks suspiciously like a bug
9494
--> $DIR/suspicious_operation_groupings.rs:133:42
9595
|
9696
LL | (((s1.a * s2.a) + (s1.b * s2.b)) + ((s1.c * s2.b) + (s1.d * s2.d)))
97-
| ^^^^^^^^^^^ help: I think you meant: `s1.c * s2.c`
97+
| ^^^^^^^^^^^ help: did you mean: `s1.c * s2.c`
9898

9999
error: this sequence of operators looks suspiciously like a bug
100100
--> $DIR/suspicious_operation_groupings.rs:138:40
101101
|
102102
LL | (((s1.a * s2.a) + (s1.b * s2.b) + (s1.c * s2.b)) + (s1.d * s2.d))
103-
| ^^^^^^^^^^^ help: I think you meant: `s1.c * s2.c`
103+
| ^^^^^^^^^^^ help: did you mean: `s1.c * s2.c`
104104

105105
error: this sequence of operators looks suspiciously like a bug
106106
--> $DIR/suspicious_operation_groupings.rs:143:40
107107
|
108108
LL | ((s1.a * s2.a) + ((s1.b * s2.b) + (s1.c * s2.b) + (s1.d * s2.d)))
109-
| ^^^^^^^^^^^ help: I think you meant: `s1.c * s2.c`
109+
| ^^^^^^^^^^^ help: did you mean: `s1.c * s2.c`
110110

111111
error: this sequence of operators looks suspiciously like a bug
112112
--> $DIR/suspicious_operation_groupings.rs:148:20
113113
|
114114
LL | (s1.a * s2.a + s2.b * s2.b) / 2
115-
| ^^^^^^^^^^^ help: I think you meant: `s1.b * s2.b`
115+
| ^^^^^^^^^^^ help: did you mean: `s1.b * s2.b`
116116

117117
error: this sequence of operators looks suspiciously like a bug
118118
--> $DIR/suspicious_operation_groupings.rs:153:35
119119
|
120120
LL | i32::swap_bytes(s1.a * s2.a + s2.b * s2.b)
121-
| ^^^^^^^^^^^ help: I think you meant: `s1.b * s2.b`
121+
| ^^^^^^^^^^^ help: did you mean: `s1.b * s2.b`
122122

123123
error: this sequence of operators looks suspiciously like a bug
124124
--> $DIR/suspicious_operation_groupings.rs:158:29
125125
|
126126
LL | s1.a > 0 && s1.b > 0 && s1.d == s2.c && s1.d == s2.d
127-
| ^^^^^^^^^^^^ help: I think you meant: `s1.c == s2.c`
127+
| ^^^^^^^^^^^^ help: did you mean: `s1.c == s2.c`
128128

129129
error: this sequence of operators looks suspiciously like a bug
130130
--> $DIR/suspicious_operation_groupings.rs:163:17
131131
|
132132
LL | s1.a > 0 && s1.d == s2.c && s1.b > 0 && s1.d == s2.d
133-
| ^^^^^^^^^^^^ help: I think you meant: `s1.c == s2.c`
133+
| ^^^^^^^^^^^^ help: did you mean: `s1.c == s2.c`
134134

135135
error: this sequence of operators looks suspiciously like a bug
136136
--> $DIR/suspicious_operation_groupings.rs:172:77
137137
|
138138
LL | (n1.inner.0).0 == (n2.inner.0).0 && (n1.inner.1).0 == (n2.inner.1).0 && (n1.inner.2).0 == (n2.inner.1).0
139-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: I think you meant: `(n1.inner.2).0 == (n2.inner.2).0`
139+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: did you mean: `(n1.inner.2).0 == (n2.inner.2).0`
140140

141141
error: this sequence of operators looks suspiciously like a bug
142142
--> $DIR/suspicious_operation_groupings.rs:186:25
143143
|
144144
LL | s1.a <= s2.a && s1.a <= s2.b
145-
| ^^^^^^^^^^^^ help: I think you meant: `s1.b <= s2.b`
145+
| ^^^^^^^^^^^^ help: did you mean: `s1.b <= s2.b`
146146

147147
error: this sequence of operators looks suspiciously like a bug
148148
--> $DIR/suspicious_operation_groupings.rs:192:23
149149
|
150150
LL | if s1.a < s2.a && s1.a < s2.b {
151-
| ^^^^^^^^^^^ help: I think you meant: `s1.b < s2.b`
151+
| ^^^^^^^^^^^ help: did you mean: `s1.b < s2.b`
152152

153153
error: this sequence of operators looks suspiciously like a bug
154154
--> $DIR/suspicious_operation_groupings.rs:199:48
155155
|
156156
LL | -(-(-s1.a * -s2.a) + (-(-s1.b * -s2.b) + -(-s1.c * -s2.b) + -(-s1.d * -s2.d)))
157-
| ^^^^^^^^^^^^^ help: I think you meant: `-s1.c * -s2.c`
157+
| ^^^^^^^^^^^^^ help: did you mean: `-s1.c * -s2.c`
158158

159159
error: this sequence of operators looks suspiciously like a bug
160160
--> $DIR/suspicious_operation_groupings.rs:204:27
161161
|
162162
LL | -(if -s1.a < -s2.a && -s1.a < -s2.b { s1.c } else { s2.a })
163-
| ^^^^^^^^^^^^^ help: I think you meant: `-s1.b < -s2.b`
163+
| ^^^^^^^^^^^^^ help: did you mean: `-s1.b < -s2.b`
164164

165165
error: aborting due to 27 previous errors
166166

0 commit comments

Comments
 (0)