Skip to content

Commit bde7d91

Browse files
committed
fix code for method
Signed-off-by: benaryorg <[email protected]>
1 parent 39aff7c commit bde7d91

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

text/0000-duration-checked-sub.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ underlying primitive types:
5454

5555
```rust
5656
impl Duration {
57-
fn checked_sub(self, rhs: Duration) -> Duration {
57+
fn checked_sub(self, rhs: Duration) -> Option<Duration> {
5858
if let Some(mut secs) = self.secs.checked_sub(rhs.secs) {
5959
let nanos = if self.nanos >= rhs.nanos {
6060
self.nanos - rhs.nanos
@@ -67,7 +67,7 @@ impl Duration {
6767
}
6868
};
6969
debug_assert!(nanos < NANOS_PER_SEC);
70-
Duration { secs: secs, nanos: nanos }
70+
Some(Duration { secs: secs, nanos: nanos })
7171
}
7272
else {
7373
None

0 commit comments

Comments
 (0)