From 4fed9901af15ee48d3eb159f8fa0f3f024922bd2 Mon Sep 17 00:00:00 2001 From: parrrate Date: Fri, 12 Sep 2025 18:33:51 +0000 Subject: [PATCH] update duration solution --- src/exercises/duration.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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)); ```