Skip to content

Commit

Permalink
impl Default for humantime::FormattedDuration (issue tailhook#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertGauld committed Sep 25, 2023
1 parent 388146a commit efd10b7
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/duration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ impl fmt::Display for Error {
}

/// A wrapper type that allows you to Display a Duration
#[derive(Debug, Clone)]
#[derive(Debug, Default, Clone)]
pub struct FormattedDuration(Duration);

trait OverflowOp: Sized {
Expand Down Expand Up @@ -454,4 +454,9 @@ mod test {
ns, us/µs, ms, sec, min, hours, days, weeks, months, \
years (and few variations)");
}

#[test]
fn has_default() {
assert_eq!(crate::FormattedDuration::default().0, Duration::default());
}
}

0 comments on commit efd10b7

Please sign in to comment.