Skip to content

Commit

Permalink
overflow-check-conditional: make lint adhere to lint message convention
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiaskrgr committed Aug 10, 2020
1 parent 9178363 commit e519bb3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions clippy_lints/src/overflow_check_conditional.rs
Expand Up @@ -42,13 +42,13 @@ impl<'tcx> LateLintPass<'tcx> for OverflowCheckConditional {
if let BinOpKind::Lt = op.node {
if let BinOpKind::Add = op2.node {
span_lint(cx, OVERFLOW_CHECK_CONDITIONAL, expr.span,
"You are trying to use classic C overflow conditions that will fail in Rust.");
"you are trying to use classic C overflow conditions that will fail in Rust");
}
}
if let BinOpKind::Gt = op.node {
if let BinOpKind::Sub = op2.node {
span_lint(cx, OVERFLOW_CHECK_CONDITIONAL, expr.span,
"You are trying to use classic C underflow conditions that will fail in Rust.");
"you are trying to use classic C underflow conditions that will fail in Rust");
}
}
}
Expand All @@ -67,13 +67,13 @@ impl<'tcx> LateLintPass<'tcx> for OverflowCheckConditional {
if let BinOpKind::Gt = op.node {
if let BinOpKind::Add = op2.node {
span_lint(cx, OVERFLOW_CHECK_CONDITIONAL, expr.span,
"You are trying to use classic C overflow conditions that will fail in Rust.");
"you are trying to use classic C overflow conditions that will fail in Rust");
}
}
if let BinOpKind::Lt = op.node {
if let BinOpKind::Sub = op2.node {
span_lint(cx, OVERFLOW_CHECK_CONDITIONAL, expr.span,
"You are trying to use classic C underflow conditions that will fail in Rust.");
"you are trying to use classic C underflow conditions that will fail in Rust");
}
}
}
Expand Down
16 changes: 8 additions & 8 deletions tests/ui/overflow_check_conditional.stderr
@@ -1,48 +1,48 @@
error: You are trying to use classic C overflow conditions that will fail in Rust.
error: you are trying to use classic C overflow conditions that will fail in Rust
--> $DIR/overflow_check_conditional.rs:8:8
|
LL | if a + b < a {}
| ^^^^^^^^^
|
= note: `-D clippy::overflow-check-conditional` implied by `-D warnings`

error: You are trying to use classic C overflow conditions that will fail in Rust.
error: you are trying to use classic C overflow conditions that will fail in Rust
--> $DIR/overflow_check_conditional.rs:9:8
|
LL | if a > a + b {}
| ^^^^^^^^^

error: You are trying to use classic C overflow conditions that will fail in Rust.
error: you are trying to use classic C overflow conditions that will fail in Rust
--> $DIR/overflow_check_conditional.rs:10:8
|
LL | if a + b < b {}
| ^^^^^^^^^

error: You are trying to use classic C overflow conditions that will fail in Rust.
error: you are trying to use classic C overflow conditions that will fail in Rust
--> $DIR/overflow_check_conditional.rs:11:8
|
LL | if b > a + b {}
| ^^^^^^^^^

error: You are trying to use classic C underflow conditions that will fail in Rust.
error: you are trying to use classic C underflow conditions that will fail in Rust
--> $DIR/overflow_check_conditional.rs:12:8
|
LL | if a - b > b {}
| ^^^^^^^^^

error: You are trying to use classic C underflow conditions that will fail in Rust.
error: you are trying to use classic C underflow conditions that will fail in Rust
--> $DIR/overflow_check_conditional.rs:13:8
|
LL | if b < a - b {}
| ^^^^^^^^^

error: You are trying to use classic C underflow conditions that will fail in Rust.
error: you are trying to use classic C underflow conditions that will fail in Rust
--> $DIR/overflow_check_conditional.rs:14:8
|
LL | if a - b > a {}
| ^^^^^^^^^

error: You are trying to use classic C underflow conditions that will fail in Rust.
error: you are trying to use classic C underflow conditions that will fail in Rust
--> $DIR/overflow_check_conditional.rs:15:8
|
LL | if a < a - b {}
Expand Down

0 comments on commit e519bb3

Please sign in to comment.