diff options
author | Michael Baikov <manpacket@gmail.com> | 2022-08-04 07:54:45 +0800 |
---|---|---|
committer | Michael Baikov <manpacket@gmail.com> | 2022-08-04 09:44:40 +0800 |
commit | a6ee63ac3212e62518c97252581cfa48e2ad056e (patch) | |
tree | a57022d55d6c819491a1ac9c510049748034440e /test/test_time.rs | |
parent | 854a5469c0475acf2e57b63740c9e447d3b9e4f8 (diff) | |
download | nix-a6ee63ac3212e62518c97252581cfa48e2ad056e.zip |
fix clippy assertions_on_result_states
https://rust-lang.github.io/rust-clippy/master/index.html#assertions_on_result_states
Diffstat (limited to 'test/test_time.rs')
-rw-r--r-- | test/test_time.rs | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/test/test_time.rs b/test/test_time.rs index dc307e57..3e8af653 100644 --- a/test/test_time.rs +++ b/test/test_time.rs @@ -11,12 +11,12 @@ use nix::time::{clock_gettime, ClockId}; #[cfg(not(target_os = "redox"))] #[test] pub fn test_clock_getres() { - assert!(nix::time::clock_getres(ClockId::CLOCK_REALTIME).is_ok()); + nix::time::clock_getres(ClockId::CLOCK_REALTIME).expect("assertion failed"); } #[test] pub fn test_clock_gettime() { - assert!(clock_gettime(ClockId::CLOCK_REALTIME).is_ok()); + clock_gettime(ClockId::CLOCK_REALTIME).expect("assertion failed"); } #[cfg(any( @@ -29,18 +29,18 @@ pub fn test_clock_gettime() { #[test] pub fn test_clock_getcpuclockid() { let clock_id = clock_getcpuclockid(nix::unistd::Pid::this()).unwrap(); - assert!(clock_gettime(clock_id).is_ok()); + clock_gettime(clock_id).expect("assert failed"); } #[cfg(not(target_os = "redox"))] #[test] pub fn test_clock_id_res() { - assert!(ClockId::CLOCK_REALTIME.res().is_ok()); + ClockId::CLOCK_REALTIME.res().expect("assert failed"); } #[test] pub fn test_clock_id_now() { - assert!(ClockId::CLOCK_REALTIME.now().is_ok()); + ClockId::CLOCK_REALTIME.now().expect("assert failed"); } #[cfg(any( @@ -52,7 +52,8 @@ pub fn test_clock_id_now() { ))] #[test] pub fn test_clock_id_pid_cpu_clock_id() { - assert!(ClockId::pid_cpu_clock_id(nix::unistd::Pid::this()) + ClockId::pid_cpu_clock_id(nix::unistd::Pid::this()) .map(ClockId::now) - .is_ok()); + .expect("assert failed") + .expect("assert failed"); } |