diff --git a/src/exercises/duration.md b/src/exercises/duration.md index 1c62826..c3708ae 100644 --- a/src/exercises/duration.md +++ b/src/exercises/duration.md @@ -4,12 +4,12 @@ Define `FIVE_SECONDS` as `const`: ```rust # use std::time::Duration; -# const fn unwrap_time(d: Option) -> Duration { match d { Some(d) => d, None => panic!() } } +# const fn unwrap(o: Option) -> T { match o { Some(t) => t, None => panic!() } } const TWO_SECONDS: Duration = Duration::from_secs(2); # /* const FIVE_SECONDS: Duration = TWO_SECONDS + Duration::from_secs(3); # */ -# const FIVE_SECONDS: Duration = unwrap_time(TWO_SECONDS.checked_add(Duration::from_secs(3))); +# const FIVE_SECONDS: Duration = unwrap(TWO_SECONDS.checked_add(Duration::from_secs(3))); assert_eq!(FIVE_SECONDS, Duration::from_secs(5)); ```