Fix confusing error message for sub_instant
When subtracting an Instant from another, the function will panick when `RHS > self`, but the error message confusingly displays a different error: ```rust let i = Instant::now(); let other = Instant::now(); if other > i { println!("{:?}", i - other); } ``` This results in a panic: ``` thread 'test_instant' panicked at 'other was less than the current instant', libstd/sys/unix/time.rs:292:17 ```
This commit is contained in:
parent
5342d40c1f
commit
95e2bf253d
1 changed files with 1 additions and 1 deletions
|
@ -289,7 +289,7 @@ mod inner {
|
|||
|
||||
pub fn sub_instant(&self, other: &Instant) -> Duration {
|
||||
self.t.sub_timespec(&other.t).unwrap_or_else(|_| {
|
||||
panic!("other was less than the current instant")
|
||||
panic!("other was greater than the current instant")
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue