From 7b7d9540056f6378820caf955a0335268184d6b7 Mon Sep 17 00:00:00 2001 From: Alan Somers Date: Sun, 30 May 2021 12:27:39 -0600 Subject: misc Clippy cleanup * Fix race conditions in the tests. Two tests were grabbing a mutex but immediately dropping it. Thank you, Clippy. * Remove vestigial Windows support. Remove some code added to support Windows in 2015. Nix is no longer intended to ever run on Windows. * Various other minor Clippy lints. --- test/test_stat.rs | 14 -------------- 1 file changed, 14 deletions(-) (limited to 'test/test_stat.rs') diff --git a/test/test_stat.rs b/test/test_stat.rs index 98112d61..27fcee59 100644 --- a/test/test_stat.rs +++ b/test/test_stat.rs @@ -44,18 +44,6 @@ use nix::unistd::chdir; #[cfg(not(any(target_os = "netbsd", target_os = "redox")))] use nix::Result; -use tempfile; - -#[allow(unused_comparisons)] -// uid and gid are signed on Windows, but not on other platforms. This function -// allows warning free compiles on all platforms, and can be removed when -// expression-level #[allow] is available. -#[cfg(not(any(target_os = "netbsd", target_os = "redox")))] -fn valid_uid_gid(stat: FileStat) -> bool { - // uid could be 0 for the `root` user. This quite possible when - // the tests are being run on a rooted Android device. - stat.st_uid >= 0 && stat.st_gid >= 0 -} #[cfg(not(any(target_os = "netbsd", target_os = "redox")))] fn assert_stat_results(stat_result: Result) { @@ -64,7 +52,6 @@ fn assert_stat_results(stat_result: Result) { assert!(stats.st_ino > 0); // inode is positive integer, exact number machine dependent assert!(stats.st_mode > 0); // must be positive integer assert_eq!(stats.st_nlink, 1); // there links created, must be 1 - assert!(valid_uid_gid(stats)); // must be positive integers assert_eq!(stats.st_size, 0); // size is 0 because we did not write anything to the file assert!(stats.st_blksize > 0); // must be positive integer, exact number machine dependent assert!(stats.st_blocks <= 16); // Up to 16 blocks can be allocated for a blank file @@ -84,7 +71,6 @@ fn assert_lstat_results(stat_result: Result) { // On other platforms they are the same (either both are u16 or u32). assert_eq!((stats.st_mode as usize) & (S_IFMT as usize), S_IFLNK as usize); // should be a link assert_eq!(stats.st_nlink, 1); // there links created, must be 1 - assert!(valid_uid_gid(stats)); // must be positive integers assert!(stats.st_size > 0); // size is > 0 because it points to another file assert!(stats.st_blksize > 0); // must be positive integer, exact number machine dependent -- cgit v1.2.3