mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-24 15:54:15 +00:00
int_plus_one: make lint adhere to lint message convention
This commit is contained in:
parent
6af297f80e
commit
f171f89aed
@ -152,7 +152,7 @@ impl IntPlusOne {
|
||||
cx,
|
||||
INT_PLUS_ONE,
|
||||
block.span,
|
||||
"Unnecessary `>= y + 1` or `x - 1 >=`",
|
||||
"unnecessary `>= y + 1` or `x - 1 >=`",
|
||||
"change it to",
|
||||
recommendation,
|
||||
Applicability::MachineApplicable, // snippet
|
||||
@ -163,8 +163,8 @@ impl IntPlusOne {
|
||||
impl EarlyLintPass for IntPlusOne {
|
||||
fn check_expr(&mut self, cx: &EarlyContext<'_>, item: &Expr) {
|
||||
if let ExprKind::Binary(ref kind, ref lhs, ref rhs) = item.kind {
|
||||
if let Some(ref rec) = Self::check_binop(cx, kind.node, lhs, rhs) {
|
||||
Self::emit_warning(cx, item, rec.clone());
|
||||
if let Some(rec) = Self::check_binop(cx, kind.node, lhs, rhs) {
|
||||
Self::emit_warning(cx, item, rec);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: Unnecessary `>= y + 1` or `x - 1 >=`
|
||||
error: unnecessary `>= y + 1` or `x - 1 >=`
|
||||
--> $DIR/int_plus_one.rs:9:13
|
||||
|
|
||||
LL | let _ = x >= y + 1;
|
||||
@ -6,19 +6,19 @@ LL | let _ = x >= y + 1;
|
||||
|
|
||||
= note: `-D clippy::int-plus-one` implied by `-D warnings`
|
||||
|
||||
error: Unnecessary `>= y + 1` or `x - 1 >=`
|
||||
error: unnecessary `>= y + 1` or `x - 1 >=`
|
||||
--> $DIR/int_plus_one.rs:10:13
|
||||
|
|
||||
LL | let _ = y + 1 <= x;
|
||||
| ^^^^^^^^^^ help: change it to: `y < x`
|
||||
|
||||
error: Unnecessary `>= y + 1` or `x - 1 >=`
|
||||
error: unnecessary `>= y + 1` or `x - 1 >=`
|
||||
--> $DIR/int_plus_one.rs:12:13
|
||||
|
|
||||
LL | let _ = x - 1 >= y;
|
||||
| ^^^^^^^^^^ help: change it to: `x > y`
|
||||
|
||||
error: Unnecessary `>= y + 1` or `x - 1 >=`
|
||||
error: unnecessary `>= y + 1` or `x - 1 >=`
|
||||
--> $DIR/int_plus_one.rs:13:13
|
||||
|
|
||||
LL | let _ = y <= x - 1;
|
||||
|
Loading…
Reference in New Issue
Block a user