diff --git a/clippy_lints/src/methods/mod.rs b/clippy_lints/src/methods/mod.rs index f5c01ac77..b0f8185e3 100644 --- a/clippy_lints/src/methods/mod.rs +++ b/clippy_lints/src/methods/mod.rs @@ -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", ); } } diff --git a/clippy_lints/src/suspicious_operation_groupings.rs b/clippy_lints/src/suspicious_operation_groupings.rs index 2ff306980..44521885d 100644 --- a/clippy_lints/src/suspicious_operation_groupings.rs +++ b/clippy_lints/src/suspicious_operation_groupings.rs @@ -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, ) diff --git a/clippy_lints/src/types.rs b/clippy_lints/src/types.rs index a18cba6fb..f71b1651b 100644 --- a/clippy_lints/src/types.rs +++ b/clippy_lints/src/types.rs @@ -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", ); diff --git a/tests/lint_message_convention.rs b/tests/lint_message_convention.rs index 1606a7881..d45d93f81 100644 --- a/tests/lint_message_convention.rs +++ b/tests/lint_message_convention.rs @@ -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(); diff --git a/tests/ui/dlist.stderr b/tests/ui/dlist.stderr index 64fde33c6..234db33ba 100644 --- a/tests/ui/dlist.stderr +++ b/tests/ui/dlist.stderr @@ -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; @@ -7,7 +7,7 @@ LL | type Baz = LinkedList; = 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); @@ -15,7 +15,7 @@ LL | fn foo(_: LinkedList); | = 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>; @@ -23,7 +23,7 @@ LL | const BAR: Option>; | = 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) {} @@ -31,7 +31,7 @@ LL | fn foo(_: LinkedList) {} | = 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) { @@ -39,7 +39,7 @@ LL | pub fn test(my_favourite_linked_list: LinkedList) { | = 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> { diff --git a/tests/ui/iterator_step_by_zero.stderr b/tests/ui/iterator_step_by_zero.stderr index c2c6803b3..d792aea11 100644 --- a/tests/ui/iterator_step_by_zero.stderr +++ b/tests/ui/iterator_step_by_zero.stderr @@ -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); diff --git a/tests/ui/suspicious_operation_groupings.stderr b/tests/ui/suspicious_operation_groupings.stderr index 2da053995..96065699d 100644 --- a/tests/ui/suspicious_operation_groupings.stderr +++ b/tests/ui/suspicious_operation_groupings.stderr @@ -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