Skip to content

Commit f171f89

Browse files
committed
int_plus_one: make lint adhere to lint message convention
1 parent 6af297f commit f171f89

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

clippy_lints/src/int_plus_one.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ impl IntPlusOne {
152152
cx,
153153
INT_PLUS_ONE,
154154
block.span,
155-
"Unnecessary `>= y + 1` or `x - 1 >=`",
155+
"unnecessary `>= y + 1` or `x - 1 >=`",
156156
"change it to",
157157
recommendation,
158158
Applicability::MachineApplicable, // snippet
@@ -163,8 +163,8 @@ impl IntPlusOne {
163163
impl EarlyLintPass for IntPlusOne {
164164
fn check_expr(&mut self, cx: &EarlyContext<'_>, item: &Expr) {
165165
if let ExprKind::Binary(ref kind, ref lhs, ref rhs) = item.kind {
166-
if let Some(ref rec) = Self::check_binop(cx, kind.node, lhs, rhs) {
167-
Self::emit_warning(cx, item, rec.clone());
166+
if let Some(rec) = Self::check_binop(cx, kind.node, lhs, rhs) {
167+
Self::emit_warning(cx, item, rec);
168168
}
169169
}
170170
}

tests/ui/int_plus_one.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
1-
error: Unnecessary `>= y + 1` or `x - 1 >=`
1+
error: unnecessary `>= y + 1` or `x - 1 >=`
22
--> $DIR/int_plus_one.rs:9:13
33
|
44
LL | let _ = x >= y + 1;
55
| ^^^^^^^^^^ help: change it to: `x > y`
66
|
77
= note: `-D clippy::int-plus-one` implied by `-D warnings`
88

9-
error: Unnecessary `>= y + 1` or `x - 1 >=`
9+
error: unnecessary `>= y + 1` or `x - 1 >=`
1010
--> $DIR/int_plus_one.rs:10:13
1111
|
1212
LL | let _ = y + 1 <= x;
1313
| ^^^^^^^^^^ help: change it to: `y < x`
1414

15-
error: Unnecessary `>= y + 1` or `x - 1 >=`
15+
error: unnecessary `>= y + 1` or `x - 1 >=`
1616
--> $DIR/int_plus_one.rs:12:13
1717
|
1818
LL | let _ = x - 1 >= y;
1919
| ^^^^^^^^^^ help: change it to: `x > y`
2020

21-
error: Unnecessary `>= y + 1` or `x - 1 >=`
21+
error: unnecessary `>= y + 1` or `x - 1 >=`
2222
--> $DIR/int_plus_one.rs:13:13
2323
|
2424
LL | let _ = y <= x - 1;

0 commit comments

Comments
 (0)