Upgrade rust/crates/nix to 0.21.0

Test: make
Change-Id: Ic8422bfdc4afc11c6c310e67999ec360d92d843d
diff --git a/test/test_stat.rs b/test/test_stat.rs
index 0b94666..27fcee5 100644
--- a/test/test_stat.rs
+++ b/test/test_stat.rs
@@ -10,7 +10,9 @@
 use std::path::Path;
 
 #[cfg(not(any(target_os = "netbsd", target_os = "redox")))]
-use libc::{S_IFMT, S_IFLNK, mode_t};
+use libc::{S_IFMT, S_IFLNK};
+#[cfg(not(target_os = "redox"))]
+use libc::mode_t;
 
 #[cfg(not(target_os = "redox"))]
 use nix::{fcntl, Error};
@@ -42,18 +44,6 @@
 
 #[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<FileStat>) {
@@ -62,13 +52,14 @@
     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
 }
 
 #[cfg(not(any(target_os = "netbsd", target_os = "redox")))]
+// (Android's st_blocks is ulonglong which is always non-negative.)
+#[cfg_attr(target_os = "android", allow(unused_comparisons))]
 fn assert_lstat_results(stat_result: Result<FileStat>) {
     let stats = stat_result.expect("stat call failed");
     assert!(stats.st_dev > 0);      // must be positive integer, exact number machine dependent
@@ -80,13 +71,11 @@
     // 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
 
     // st_blocks depends on whether the machine's file system uses fast
     // or slow symlinks, so just make sure it's not negative
-    // (Android's st_blocks is ulonglong which is always non-negative.)
     assert!(stats.st_blocks >= 0);
 }
 
@@ -159,14 +148,14 @@
     fchmod(file.as_raw_fd(), mode1).unwrap();
 
     let file_stat1 = stat(&filename).unwrap();
-    assert_eq!(file_stat1.st_mode & 0o7777, mode1.bits());
+    assert_eq!(file_stat1.st_mode as mode_t & 0o7777, mode1.bits());
 
     let mut mode2 = Mode::empty();
     mode2.insert(Mode::S_IROTH);
     fchmod(file.as_raw_fd(), mode2).unwrap();
 
     let file_stat2 = stat(&filename).unwrap();
-    assert_eq!(file_stat2.st_mode & 0o7777, mode2.bits());
+    assert_eq!(file_stat2.st_mode as mode_t & 0o7777, mode2.bits());
 }
 
 #[test]
@@ -186,7 +175,7 @@
     fchmodat(Some(dirfd), filename, mode1, FchmodatFlags::FollowSymlink).unwrap();
 
     let file_stat1 = stat(&fullpath).unwrap();
-    assert_eq!(file_stat1.st_mode & 0o7777, mode1.bits());
+    assert_eq!(file_stat1.st_mode as mode_t & 0o7777, mode1.bits());
 
     chdir(tempdir.path()).unwrap();
 
@@ -195,7 +184,7 @@
     fchmodat(None, filename, mode2, FchmodatFlags::FollowSymlink).unwrap();
 
     let file_stat2 = stat(&fullpath).unwrap();
-    assert_eq!(file_stat2.st_mode & 0o7777, mode2.bits());
+    assert_eq!(file_stat2.st_mode as mode_t & 0o7777, mode2.bits());
 }
 
 /// Asserts that the atime and mtime in a file's metadata match expected values.