We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f7a329c commit 004e064Copy full SHA for 004e064
1 file changed
src/frontend.rs
@@ -339,10 +339,14 @@ pub struct ModuleReviewMetrics {
339
impl ReviewMetricsTemplate {
340
pub fn format_duration(&self, duration: &Option<TimeDelta>) -> String {
341
if let Some(duration) = duration {
342
- let secs = duration.to_std().unwrap().as_secs();
343
- let secs_without_hours = secs - (secs % (60 * 60));
344
- humantime::format_duration(std::time::Duration::from_secs(secs_without_hours))
345
- .to_string()
+ if let Ok(duration) = duration.to_std() {
+ let secs = duration.as_secs();
+ let secs_without_hours = secs - (secs % (60 * 60));
+ humantime::format_duration(std::time::Duration::from_secs(secs_without_hours))
346
+ .to_string()
347
+ } else {
348
+ format!("Invalid duration: {:?}", duration)
349
+ }
350
} else {
351
"Not yet".to_owned()
352
}
0 commit comments