fix: remove (redundant) semicolon in lint suggestion
This commit is contained in:
parent
62ab4fb9c2
commit
862ac29192
@ -174,7 +174,7 @@ fn print_unchecked_duration_subtraction_sugg(
|
|||||||
expr.span,
|
expr.span,
|
||||||
"unchecked subtraction of a 'Duration' from an 'Instant'",
|
"unchecked subtraction of a 'Duration' from an 'Instant'",
|
||||||
"try",
|
"try",
|
||||||
format!("{left_expr}.checked_sub({right_expr}).unwrap();"),
|
format!("{left_expr}.checked_sub({right_expr}).unwrap()"),
|
||||||
applicability,
|
applicability,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -7,11 +7,11 @@ fn main() {
|
|||||||
let _first = Instant::now();
|
let _first = Instant::now();
|
||||||
let second = Duration::from_secs(3);
|
let second = Duration::from_secs(3);
|
||||||
|
|
||||||
let _ = _first.checked_sub(second).unwrap();;
|
let _ = _first.checked_sub(second).unwrap();
|
||||||
|
|
||||||
let _ = Instant::now().checked_sub(Duration::from_secs(5)).unwrap();;
|
let _ = Instant::now().checked_sub(Duration::from_secs(5)).unwrap();
|
||||||
|
|
||||||
let _ = _first.checked_sub(Duration::from_secs(5)).unwrap();;
|
let _ = _first.checked_sub(Duration::from_secs(5)).unwrap();
|
||||||
|
|
||||||
let _ = Instant::now().checked_sub(second).unwrap();;
|
let _ = Instant::now().checked_sub(second).unwrap();
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ error: unchecked subtraction of a 'Duration' from an 'Instant'
|
|||||||
--> $DIR/unchecked_duration_subtraction.rs:10:13
|
--> $DIR/unchecked_duration_subtraction.rs:10:13
|
||||||
|
|
|
|
||||||
LL | let _ = _first - second;
|
LL | let _ = _first - second;
|
||||||
| ^^^^^^^^^^^^^^^ help: try: `_first.checked_sub(second).unwrap();`
|
| ^^^^^^^^^^^^^^^ help: try: `_first.checked_sub(second).unwrap()`
|
||||||
|
|
|
|
||||||
= note: `-D clippy::unchecked-duration-subtraction` implied by `-D warnings`
|
= note: `-D clippy::unchecked-duration-subtraction` implied by `-D warnings`
|
||||||
|
|
||||||
@ -10,19 +10,19 @@ error: unchecked subtraction of a 'Duration' from an 'Instant'
|
|||||||
--> $DIR/unchecked_duration_subtraction.rs:12:13
|
--> $DIR/unchecked_duration_subtraction.rs:12:13
|
||||||
|
|
|
|
||||||
LL | let _ = Instant::now() - Duration::from_secs(5);
|
LL | let _ = Instant::now() - Duration::from_secs(5);
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Instant::now().checked_sub(Duration::from_secs(5)).unwrap();`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Instant::now().checked_sub(Duration::from_secs(5)).unwrap()`
|
||||||
|
|
||||||
error: unchecked subtraction of a 'Duration' from an 'Instant'
|
error: unchecked subtraction of a 'Duration' from an 'Instant'
|
||||||
--> $DIR/unchecked_duration_subtraction.rs:14:13
|
--> $DIR/unchecked_duration_subtraction.rs:14:13
|
||||||
|
|
|
|
||||||
LL | let _ = _first - Duration::from_secs(5);
|
LL | let _ = _first - Duration::from_secs(5);
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `_first.checked_sub(Duration::from_secs(5)).unwrap();`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `_first.checked_sub(Duration::from_secs(5)).unwrap()`
|
||||||
|
|
||||||
error: unchecked subtraction of a 'Duration' from an 'Instant'
|
error: unchecked subtraction of a 'Duration' from an 'Instant'
|
||||||
--> $DIR/unchecked_duration_subtraction.rs:16:13
|
--> $DIR/unchecked_duration_subtraction.rs:16:13
|
||||||
|
|
|
|
||||||
LL | let _ = Instant::now() - second;
|
LL | let _ = Instant::now() - second;
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Instant::now().checked_sub(second).unwrap();`
|
| ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Instant::now().checked_sub(second).unwrap()`
|
||||||
|
|
||||||
error: aborting due to 4 previous errors
|
error: aborting due to 4 previous errors
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user