Skip to content

Commit

Permalink
fix code for method
Browse files Browse the repository at this point in the history
Signed-off-by: benaryorg <binary@benary.org>
  • Loading branch information
benaryorg committed Aug 16, 2016
1 parent 39aff7c commit bde7d91
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions text/0000-duration-checked-sub.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ underlying primitive types:

```rust
impl Duration {
fn checked_sub(self, rhs: Duration) -> Duration {
fn checked_sub(self, rhs: Duration) -> Option<Duration> {
if let Some(mut secs) = self.secs.checked_sub(rhs.secs) {
let nanos = if self.nanos >= rhs.nanos {
self.nanos - rhs.nanos
Expand All @@ -67,7 +67,7 @@ impl Duration {
}
};
debug_assert!(nanos < NANOS_PER_SEC);
Duration { secs: secs, nanos: nanos }
Some(Duration { secs: secs, nanos: nanos })
}
else {
None
Expand Down

0 comments on commit bde7d91

Please sign in to comment.