blob: c129497447fc059966cf68c5d2017180e88bb256 [file]
error: unchecked subtraction of a `Duration`
--> tests/ui/unchecked_time_subtraction.rs:9:13
|
LL | let _ = _first - second;
| ^^^^^^^^^^^^^^^ help: try: `_first.checked_sub(second).unwrap()`
|
= note: `-D clippy::unchecked-time-subtraction` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::unchecked_time_subtraction)]`
error: unchecked subtraction of a `Duration`
--> tests/ui/unchecked_time_subtraction.rs:12:13
|
LL | let _ = Instant::now() - Duration::from_secs(5);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Instant::now().checked_sub(Duration::from_secs(5)).unwrap()`
error: unchecked subtraction of a `Duration`
--> tests/ui/unchecked_time_subtraction.rs:15:13
|
LL | let _ = _first - Duration::from_secs(5);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `_first.checked_sub(Duration::from_secs(5)).unwrap()`
error: unchecked subtraction of a `Duration`
--> tests/ui/unchecked_time_subtraction.rs:18:13
|
LL | let _ = Instant::now() - second;
| ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Instant::now().checked_sub(second).unwrap()`
error: unchecked subtraction of a `Duration`
--> tests/ui/unchecked_time_subtraction.rs:25:13
|
LL | let _ = dur1 - dur2;
| ^^^^^^^^^^^ help: try: `dur1.checked_sub(dur2).unwrap()`
error: unchecked subtraction of a `Duration`
--> tests/ui/unchecked_time_subtraction.rs:28:13
|
LL | let _ = Duration::from_secs(10) - Duration::from_secs(5);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Duration::from_secs(10).checked_sub(Duration::from_secs(5)).unwrap()`
error: unchecked subtraction of a `Duration`
--> tests/ui/unchecked_time_subtraction.rs:31:13
|
LL | let _ = second - dur1;
| ^^^^^^^^^^^^^ help: try: `second.checked_sub(dur1).unwrap()`
error: unchecked subtraction of a `Duration`
--> tests/ui/unchecked_time_subtraction.rs:35:13
|
LL | let _ = 2 * dur1 - dur2;
| ^^^^^^^^^^^^^^^ help: try: `(2 * dur1).checked_sub(dur2).unwrap()`
error: aborting due to 8 previous errors