mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-23 21:23:56 +00:00
change some lint messages and remove old entries from the ignorelist
This commit is contained in:
parent
e107b65b5a
commit
e00b1cc73a
7 changed files with 43 additions and 47 deletions
|
@ -2569,7 +2569,7 @@ fn lint_step_by<'tcx>(cx: &LateContext<'tcx>, expr: &hir::Expr<'_>, args: &'tcx
|
|||
cx,
|
||||
ITERATOR_STEP_BY_ZERO,
|
||||
expr.span,
|
||||
"Iterator::step_by(0) will panic at runtime",
|
||||
"`Iterator::step_by(0)` will panic at runtime",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -262,7 +262,7 @@ fn emit_suggestion(cx: &EarlyContext<'_>, span: Span, sugg: String, applicabilit
|
|||
SUSPICIOUS_OPERATION_GROUPINGS,
|
||||
span,
|
||||
"this sequence of operators looks suspiciously like a bug",
|
||||
"I think you meant",
|
||||
"did you mean",
|
||||
sugg,
|
||||
applicability,
|
||||
)
|
||||
|
|
|
@ -578,7 +578,7 @@ impl Types {
|
|||
cx,
|
||||
LINKEDLIST,
|
||||
hir_ty.span,
|
||||
"I see you're using a LinkedList! Perhaps you meant some other data structure?",
|
||||
"you seem to be using a `LinkedList`! Perhaps you meant some other data structure?",
|
||||
None,
|
||||
"a `VecDeque` might work",
|
||||
);
|
||||
|
|
|
@ -31,9 +31,7 @@ impl Message {
|
|||
// sometimes the first character is capitalized and it is legal (like in "Iterator...") or
|
||||
// we want to ask a question ending in "?"
|
||||
let exceptions_set: RegexSet = RegexSet::new(&[
|
||||
r".*error: I see you're using a LinkedList! Perhaps you meant some other data structure?",
|
||||
r".*C-like enum variant discriminant is not portable to 32-bit targets",
|
||||
r".*Iterator::step_by(0) will panic at runtime",
|
||||
r".*did you mean `unix`?",
|
||||
r".*the arguments may be inverted...",
|
||||
r".*Intel x86 assembly syntax used",
|
||||
|
@ -41,8 +39,6 @@ impl Message {
|
|||
r".*remove .*the return type...",
|
||||
r"note: Clippy version: .*",
|
||||
r"the compiler unexpectedly panicked. this is a bug.",
|
||||
r".*help: I think you meant: .*",
|
||||
r"Iterator.* will panic at runtime",
|
||||
])
|
||||
.unwrap();
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
error: I see you're using a LinkedList! Perhaps you meant some other data structure?
|
||||
error: you seem to be using a `LinkedList`! Perhaps you meant some other data structure?
|
||||
--> $DIR/dlist.rs:9:16
|
||||
|
|
||||
LL | type Baz = LinkedList<u8>;
|
||||
|
@ -7,7 +7,7 @@ LL | type Baz = LinkedList<u8>;
|
|||
= note: `-D clippy::linkedlist` implied by `-D warnings`
|
||||
= help: a `VecDeque` might work
|
||||
|
||||
error: I see you're using a LinkedList! Perhaps you meant some other data structure?
|
||||
error: you seem to be using a `LinkedList`! Perhaps you meant some other data structure?
|
||||
--> $DIR/dlist.rs:10:15
|
||||
|
|
||||
LL | fn foo(_: LinkedList<u8>);
|
||||
|
@ -15,7 +15,7 @@ LL | fn foo(_: LinkedList<u8>);
|
|||
|
|
||||
= help: a `VecDeque` might work
|
||||
|
||||
error: I see you're using a LinkedList! Perhaps you meant some other data structure?
|
||||
error: you seem to be using a `LinkedList`! Perhaps you meant some other data structure?
|
||||
--> $DIR/dlist.rs:11:23
|
||||
|
|
||||
LL | const BAR: Option<LinkedList<u8>>;
|
||||
|
@ -23,7 +23,7 @@ LL | const BAR: Option<LinkedList<u8>>;
|
|||
|
|
||||
= help: a `VecDeque` might work
|
||||
|
||||
error: I see you're using a LinkedList! Perhaps you meant some other data structure?
|
||||
error: you seem to be using a `LinkedList`! Perhaps you meant some other data structure?
|
||||
--> $DIR/dlist.rs:22:15
|
||||
|
|
||||
LL | fn foo(_: LinkedList<u8>) {}
|
||||
|
@ -31,7 +31,7 @@ LL | fn foo(_: LinkedList<u8>) {}
|
|||
|
|
||||
= help: a `VecDeque` might work
|
||||
|
||||
error: I see you're using a LinkedList! Perhaps you meant some other data structure?
|
||||
error: you seem to be using a `LinkedList`! Perhaps you meant some other data structure?
|
||||
--> $DIR/dlist.rs:25:39
|
||||
|
|
||||
LL | pub fn test(my_favourite_linked_list: LinkedList<u8>) {
|
||||
|
@ -39,7 +39,7 @@ LL | pub fn test(my_favourite_linked_list: LinkedList<u8>) {
|
|||
|
|
||||
= help: a `VecDeque` might work
|
||||
|
||||
error: I see you're using a LinkedList! Perhaps you meant some other data structure?
|
||||
error: you seem to be using a `LinkedList`! Perhaps you meant some other data structure?
|
||||
--> $DIR/dlist.rs:29:29
|
||||
|
|
||||
LL | pub fn test_ret() -> Option<LinkedList<u8>> {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
error: Iterator::step_by(0) will panic at runtime
|
||||
error: `Iterator::step_by(0)` will panic at runtime
|
||||
--> $DIR/iterator_step_by_zero.rs:3:13
|
||||
|
|
||||
LL | let _ = vec!["A", "B", "B"].iter().step_by(0);
|
||||
|
@ -6,37 +6,37 @@ LL | let _ = vec!["A", "B", "B"].iter().step_by(0);
|
|||
|
|
||||
= note: `-D clippy::iterator-step-by-zero` implied by `-D warnings`
|
||||
|
||||
error: Iterator::step_by(0) will panic at runtime
|
||||
error: `Iterator::step_by(0)` will panic at runtime
|
||||
--> $DIR/iterator_step_by_zero.rs:4:13
|
||||
|
|
||||
LL | let _ = "XXX".chars().step_by(0);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: Iterator::step_by(0) will panic at runtime
|
||||
error: `Iterator::step_by(0)` will panic at runtime
|
||||
--> $DIR/iterator_step_by_zero.rs:5:13
|
||||
|
|
||||
LL | let _ = (0..1).step_by(0);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: Iterator::step_by(0) will panic at runtime
|
||||
error: `Iterator::step_by(0)` will panic at runtime
|
||||
--> $DIR/iterator_step_by_zero.rs:14:13
|
||||
|
|
||||
LL | let _ = (1..).step_by(0);
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
||||
error: Iterator::step_by(0) will panic at runtime
|
||||
error: `Iterator::step_by(0)` will panic at runtime
|
||||
--> $DIR/iterator_step_by_zero.rs:15:13
|
||||
|
|
||||
LL | let _ = (1..=2).step_by(0);
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: Iterator::step_by(0) will panic at runtime
|
||||
error: `Iterator::step_by(0)` will panic at runtime
|
||||
--> $DIR/iterator_step_by_zero.rs:18:13
|
||||
|
|
||||
LL | let _ = x.step_by(0);
|
||||
| ^^^^^^^^^^^^
|
||||
|
||||
error: Iterator::step_by(0) will panic at runtime
|
||||
error: `Iterator::step_by(0)` will panic at runtime
|
||||
--> $DIR/iterator_step_by_zero.rs:22:13
|
||||
|
|
||||
LL | let _ = v1.iter().step_by(2 / 3);
|
||||
|
|
|
@ -2,7 +2,7 @@ error: this sequence of operators looks suspiciously like a bug
|
|||
--> $DIR/suspicious_operation_groupings.rs:14:9
|
||||
|
|
||||
LL | self.x == other.y && self.y == other.y && self.z == other.z
|
||||
| ^^^^^^^^^^^^^^^^^ help: I think you meant: `self.x == other.x`
|
||||
| ^^^^^^^^^^^^^^^^^ help: did you mean: `self.x == other.x`
|
||||
|
|
||||
= note: `-D clippy::suspicious-operation-groupings` implied by `-D warnings`
|
||||
|
||||
|
@ -10,157 +10,157 @@ error: this sequence of operators looks suspiciously like a bug
|
|||
--> $DIR/suspicious_operation_groupings.rs:14:9
|
||||
|
|
||||
LL | self.x == other.y && self.y == other.y && self.z == other.z
|
||||
| ^^^^^^^^^^^^^^^^^ help: I think you meant: `self.x == other.x`
|
||||
| ^^^^^^^^^^^^^^^^^ help: did you mean: `self.x == other.x`
|
||||
|
||||
error: this sequence of operators looks suspiciously like a bug
|
||||
--> $DIR/suspicious_operation_groupings.rs:27:20
|
||||
|
|
||||
LL | s1.a < s2.a && s1.a < s2.b
|
||||
| ^^^^^^^^^^^ help: I think you meant: `s1.b < s2.b`
|
||||
| ^^^^^^^^^^^ help: did you mean: `s1.b < s2.b`
|
||||
|
||||
error: this sequence of operators looks suspiciously like a bug
|
||||
--> $DIR/suspicious_operation_groupings.rs:75:33
|
||||
|
|
||||
LL | s1.a * s2.a + s1.b * s2.b + s1.c * s2.b + s1.d * s2.d
|
||||
| ^^^^^^^^^^^ help: I think you meant: `s1.c * s2.c`
|
||||
| ^^^^^^^^^^^ help: did you mean: `s1.c * s2.c`
|
||||
|
||||
error: this sequence of operators looks suspiciously like a bug
|
||||
--> $DIR/suspicious_operation_groupings.rs:80:19
|
||||
|
|
||||
LL | s1.a * s2.a + s1.b * s2.c + s1.c * s2.c
|
||||
| ^^^^^^^^^^^ help: I think you meant: `s1.b * s2.b`
|
||||
| ^^^^^^^^^^^ help: did you mean: `s1.b * s2.b`
|
||||
|
||||
error: this sequence of operators looks suspiciously like a bug
|
||||
--> $DIR/suspicious_operation_groupings.rs:80:19
|
||||
|
|
||||
LL | s1.a * s2.a + s1.b * s2.c + s1.c * s2.c
|
||||
| ^^^^^^^^^^^ help: I think you meant: `s1.b * s2.b`
|
||||
| ^^^^^^^^^^^ help: did you mean: `s1.b * s2.b`
|
||||
|
||||
error: this sequence of operators looks suspiciously like a bug
|
||||
--> $DIR/suspicious_operation_groupings.rs:85:19
|
||||
|
|
||||
LL | s1.a * s2.a + s2.b * s2.b + s1.c * s2.c
|
||||
| ^^^^^^^^^^^ help: I think you meant: `s1.b * s2.b`
|
||||
| ^^^^^^^^^^^ help: did you mean: `s1.b * s2.b`
|
||||
|
||||
error: this sequence of operators looks suspiciously like a bug
|
||||
--> $DIR/suspicious_operation_groupings.rs:90:19
|
||||
|
|
||||
LL | s1.a * s2.a + s1.b * s1.b + s1.c * s2.c
|
||||
| ^^^^^^^^^^^ help: I think you meant: `s1.b * s2.b`
|
||||
| ^^^^^^^^^^^ help: did you mean: `s1.b * s2.b`
|
||||
|
||||
error: this sequence of operators looks suspiciously like a bug
|
||||
--> $DIR/suspicious_operation_groupings.rs:95:5
|
||||
|
|
||||
LL | s1.a * s1.a + s1.b * s2.b + s1.c * s2.c
|
||||
| ^^^^^^^^^^^ help: I think you meant: `s1.a * s2.a`
|
||||
| ^^^^^^^^^^^ help: did you mean: `s1.a * s2.a`
|
||||
|
||||
error: this sequence of operators looks suspiciously like a bug
|
||||
--> $DIR/suspicious_operation_groupings.rs:100:33
|
||||
|
|
||||
LL | s1.a * s2.a + s1.b * s2.b + s1.c * s1.c
|
||||
| ^^^^^^^^^^^ help: I think you meant: `s1.c * s2.c`
|
||||
| ^^^^^^^^^^^ help: did you mean: `s1.c * s2.c`
|
||||
|
||||
error: this sequence of operators looks suspiciously like a bug
|
||||
--> $DIR/suspicious_operation_groupings.rs:113:20
|
||||
|
|
||||
LL | (s1.a * s2.a + s1.b * s1.b)
|
||||
| ^^^^^^^^^^^ help: I think you meant: `s1.b * s2.b`
|
||||
| ^^^^^^^^^^^ help: did you mean: `s1.b * s2.b`
|
||||
|
||||
error: this sequence of operators looks suspiciously like a bug
|
||||
--> $DIR/suspicious_operation_groupings.rs:118:34
|
||||
|
|
||||
LL | (s1.a * s2.a + s1.b * s2.b + s1.c * s2.b + s1.d * s2.d)
|
||||
| ^^^^^^^^^^^ help: I think you meant: `s1.c * s2.c`
|
||||
| ^^^^^^^^^^^ help: did you mean: `s1.c * s2.c`
|
||||
|
||||
error: this sequence of operators looks suspiciously like a bug
|
||||
--> $DIR/suspicious_operation_groupings.rs:123:38
|
||||
|
|
||||
LL | (s1.a * s2.a) + (s1.b * s2.b) + (s1.c * s2.b) + (s1.d * s2.d)
|
||||
| ^^^^^^^^^^^ help: I think you meant: `s1.c * s2.c`
|
||||
| ^^^^^^^^^^^ help: did you mean: `s1.c * s2.c`
|
||||
|
||||
error: this sequence of operators looks suspiciously like a bug
|
||||
--> $DIR/suspicious_operation_groupings.rs:128:39
|
||||
|
|
||||
LL | ((s1.a * s2.a) + (s1.b * s2.b) + (s1.c * s2.b) + (s1.d * s2.d))
|
||||
| ^^^^^^^^^^^ help: I think you meant: `s1.c * s2.c`
|
||||
| ^^^^^^^^^^^ help: did you mean: `s1.c * s2.c`
|
||||
|
||||
error: this sequence of operators looks suspiciously like a bug
|
||||
--> $DIR/suspicious_operation_groupings.rs:133:42
|
||||
|
|
||||
LL | (((s1.a * s2.a) + (s1.b * s2.b)) + ((s1.c * s2.b) + (s1.d * s2.d)))
|
||||
| ^^^^^^^^^^^ help: I think you meant: `s1.c * s2.c`
|
||||
| ^^^^^^^^^^^ help: did you mean: `s1.c * s2.c`
|
||||
|
||||
error: this sequence of operators looks suspiciously like a bug
|
||||
--> $DIR/suspicious_operation_groupings.rs:133:42
|
||||
|
|
||||
LL | (((s1.a * s2.a) + (s1.b * s2.b)) + ((s1.c * s2.b) + (s1.d * s2.d)))
|
||||
| ^^^^^^^^^^^ help: I think you meant: `s1.c * s2.c`
|
||||
| ^^^^^^^^^^^ help: did you mean: `s1.c * s2.c`
|
||||
|
||||
error: this sequence of operators looks suspiciously like a bug
|
||||
--> $DIR/suspicious_operation_groupings.rs:138:40
|
||||
|
|
||||
LL | (((s1.a * s2.a) + (s1.b * s2.b) + (s1.c * s2.b)) + (s1.d * s2.d))
|
||||
| ^^^^^^^^^^^ help: I think you meant: `s1.c * s2.c`
|
||||
| ^^^^^^^^^^^ help: did you mean: `s1.c * s2.c`
|
||||
|
||||
error: this sequence of operators looks suspiciously like a bug
|
||||
--> $DIR/suspicious_operation_groupings.rs:143:40
|
||||
|
|
||||
LL | ((s1.a * s2.a) + ((s1.b * s2.b) + (s1.c * s2.b) + (s1.d * s2.d)))
|
||||
| ^^^^^^^^^^^ help: I think you meant: `s1.c * s2.c`
|
||||
| ^^^^^^^^^^^ help: did you mean: `s1.c * s2.c`
|
||||
|
||||
error: this sequence of operators looks suspiciously like a bug
|
||||
--> $DIR/suspicious_operation_groupings.rs:148:20
|
||||
|
|
||||
LL | (s1.a * s2.a + s2.b * s2.b) / 2
|
||||
| ^^^^^^^^^^^ help: I think you meant: `s1.b * s2.b`
|
||||
| ^^^^^^^^^^^ help: did you mean: `s1.b * s2.b`
|
||||
|
||||
error: this sequence of operators looks suspiciously like a bug
|
||||
--> $DIR/suspicious_operation_groupings.rs:153:35
|
||||
|
|
||||
LL | i32::swap_bytes(s1.a * s2.a + s2.b * s2.b)
|
||||
| ^^^^^^^^^^^ help: I think you meant: `s1.b * s2.b`
|
||||
| ^^^^^^^^^^^ help: did you mean: `s1.b * s2.b`
|
||||
|
||||
error: this sequence of operators looks suspiciously like a bug
|
||||
--> $DIR/suspicious_operation_groupings.rs:158:29
|
||||
|
|
||||
LL | s1.a > 0 && s1.b > 0 && s1.d == s2.c && s1.d == s2.d
|
||||
| ^^^^^^^^^^^^ help: I think you meant: `s1.c == s2.c`
|
||||
| ^^^^^^^^^^^^ help: did you mean: `s1.c == s2.c`
|
||||
|
||||
error: this sequence of operators looks suspiciously like a bug
|
||||
--> $DIR/suspicious_operation_groupings.rs:163:17
|
||||
|
|
||||
LL | s1.a > 0 && s1.d == s2.c && s1.b > 0 && s1.d == s2.d
|
||||
| ^^^^^^^^^^^^ help: I think you meant: `s1.c == s2.c`
|
||||
| ^^^^^^^^^^^^ help: did you mean: `s1.c == s2.c`
|
||||
|
||||
error: this sequence of operators looks suspiciously like a bug
|
||||
--> $DIR/suspicious_operation_groupings.rs:172:77
|
||||
|
|
||||
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
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: I think you meant: `(n1.inner.2).0 == (n2.inner.2).0`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: did you mean: `(n1.inner.2).0 == (n2.inner.2).0`
|
||||
|
||||
error: this sequence of operators looks suspiciously like a bug
|
||||
--> $DIR/suspicious_operation_groupings.rs:186:25
|
||||
|
|
||||
LL | s1.a <= s2.a && s1.a <= s2.b
|
||||
| ^^^^^^^^^^^^ help: I think you meant: `s1.b <= s2.b`
|
||||
| ^^^^^^^^^^^^ help: did you mean: `s1.b <= s2.b`
|
||||
|
||||
error: this sequence of operators looks suspiciously like a bug
|
||||
--> $DIR/suspicious_operation_groupings.rs:192:23
|
||||
|
|
||||
LL | if s1.a < s2.a && s1.a < s2.b {
|
||||
| ^^^^^^^^^^^ help: I think you meant: `s1.b < s2.b`
|
||||
| ^^^^^^^^^^^ help: did you mean: `s1.b < s2.b`
|
||||
|
||||
error: this sequence of operators looks suspiciously like a bug
|
||||
--> $DIR/suspicious_operation_groupings.rs:199:48
|
||||
|
|
||||
LL | -(-(-s1.a * -s2.a) + (-(-s1.b * -s2.b) + -(-s1.c * -s2.b) + -(-s1.d * -s2.d)))
|
||||
| ^^^^^^^^^^^^^ help: I think you meant: `-s1.c * -s2.c`
|
||||
| ^^^^^^^^^^^^^ help: did you mean: `-s1.c * -s2.c`
|
||||
|
||||
error: this sequence of operators looks suspiciously like a bug
|
||||
--> $DIR/suspicious_operation_groupings.rs:204:27
|
||||
|
|
||||
LL | -(if -s1.a < -s2.a && -s1.a < -s2.b { s1.c } else { s2.a })
|
||||
| ^^^^^^^^^^^^^ help: I think you meant: `-s1.b < -s2.b`
|
||||
| ^^^^^^^^^^^^^ help: did you mean: `-s1.b < -s2.b`
|
||||
|
||||
error: aborting due to 27 previous errors
|
||||
|
||||
|
|
Loading…
Reference in a new issue