Skip to content

Commit 404aa68

Browse files
committed
Use TryFrom in tests for TimeSpec
1 parent 077d6d2 commit 404aa68

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

test/sys/test_time.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ pub fn test_timespec() {
1515
}
1616

1717
#[test]
18-
pub fn test_timespec_from() {
18+
pub fn test_timespec_try_from() {
1919
let duration = Duration::new(123, 123_456_789);
2020
let timespec = TimeSpec::nanoseconds(123_123_456_789);
2121

22-
assert_eq!(TimeSpec::from(duration), timespec);
23-
assert_eq!(Duration::from(timespec), duration);
22+
assert_eq!(TimeSpec::try_from(duration).unwrap(), timespec);
23+
assert_eq!(Duration::try_from(timespec).unwrap(), duration);
2424
}
2525

2626
#[test]

0 commit comments

Comments
 (0)