diff --git a/tests/by-util/test_cat.rs b/tests/by-util/test_cat.rs index c21994bbb..1869105d0 100644 --- a/tests/by-util/test_cat.rs +++ b/tests/by-util/test_cat.rs @@ -511,7 +511,7 @@ fn test_write_to_self() { .create_new(true) .write(true) .append(true) - .open(&file_path) + .open(file_path) .unwrap(); s.fixtures.append("first_file", "first_file_content."); diff --git a/tests/by-util/test_cp.rs b/tests/by-util/test_cp.rs index ade4d820f..34b6472d0 100644 --- a/tests/by-util/test_cp.rs +++ b/tests/by-util/test_cp.rs @@ -1085,7 +1085,7 @@ fn test_cp_no_deref_folder_to_folder() { fn test_cp_archive() { let (at, mut ucmd) = at_and_ucmd!(); let ts = time::OffsetDateTime::now_local().unwrap(); - let previous = FileTime::from_unix_time(ts.unix_timestamp() - 3600, ts.nanosecond() as u32); + let previous = FileTime::from_unix_time(ts.unix_timestamp() - 3600, ts.nanosecond()); // set the file creation/modification an hour ago filetime::set_file_times( at.plus_as_string(TEST_HELLO_WORLD_SOURCE), diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index 0b3b3f788..c84fdd4f0 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -2057,7 +2057,7 @@ fn test_ls_indicator_style() { .tempdir() .expect("failed to create dir"); let socket_path = dir.path().join("sock"); - let _listener = UnixListener::bind(&socket_path).expect("failed to create socket"); + let _listener = UnixListener::bind(socket_path).expect("failed to create socket"); new_ucmd!() .args(&[ diff --git a/tests/by-util/test_mv.rs b/tests/by-util/test_mv.rs index 9dd06c9f1..55ac7d68d 100644 --- a/tests/by-util/test_mv.rs +++ b/tests/by-util/test_mv.rs @@ -621,7 +621,7 @@ fn test_mv_update_option() { at.touch(file_b); let ts = time::OffsetDateTime::now_local().unwrap(); let now = FileTime::from_unix_time(ts.unix_timestamp(), ts.nanosecond()); - let later = FileTime::from_unix_time(ts.unix_timestamp() as i64 + 3600, ts.nanosecond() as u32); + let later = FileTime::from_unix_time(ts.unix_timestamp() + 3600, ts.nanosecond()); filetime::set_file_times(at.plus_as_string(file_a), now, now).unwrap(); filetime::set_file_times(at.plus_as_string(file_b), now, later).unwrap(); diff --git a/tests/by-util/test_split.rs b/tests/by-util/test_split.rs index 85f3e7eea..2ff448a79 100644 --- a/tests/by-util/test_split.rs +++ b/tests/by-util/test_split.rs @@ -85,7 +85,7 @@ impl RandomFile { /// `create()` file handle located at `at` / `name` fn new(at: &AtPath, name: &str) -> Self { Self { - inner: File::create(&at.plus(name)).unwrap(), + inner: File::create(at.plus(name)).unwrap(), } } diff --git a/tests/by-util/test_touch.rs b/tests/by-util/test_touch.rs index a89e808de..2b2cb5266 100644 --- a/tests/by-util/test_touch.rs +++ b/tests/by-util/test_touch.rs @@ -34,7 +34,7 @@ fn get_symlink_times(at: &AtPath, path: &str) -> (FileTime, FileTime) { } fn set_file_times(at: &AtPath, path: &str, atime: FileTime, mtime: FileTime) { - filetime::set_file_times(&at.plus_as_string(path), atime, mtime).unwrap(); + filetime::set_file_times(at.plus_as_string(path), atime, mtime).unwrap(); } // Adjusts for local timezone diff --git a/tests/by-util/test_yes.rs b/tests/by-util/test_yes.rs index dd455a933..545ac2236 100644 --- a/tests/by-util/test_yes.rs +++ b/tests/by-util/test_yes.rs @@ -8,7 +8,7 @@ use crate::common::util::*; #[cfg(unix)] fn check_termination(result: &ExitStatus) { - assert_eq!(result.signal(), Some(libc::SIGPIPE as i32)); + assert_eq!(result.signal(), Some(libc::SIGPIPE)); } #[cfg(not(unix))] diff --git a/tests/common/util.rs b/tests/common/util.rs index cc25a6889..c932182ce 100644 --- a/tests/common/util.rs +++ b/tests/common/util.rs @@ -470,7 +470,7 @@ pub fn recursive_copy(src: &Path, dest: &Path) -> Result<()> { fs::create_dir(&new_dest)?; recursive_copy(&entry.path(), &new_dest)?; } else { - fs::copy(&entry.path(), new_dest)?; + fs::copy(entry.path(), new_dest)?; } } } @@ -631,12 +631,12 @@ impl AtPath { pub fn rmdir(&self, dir: &str) { log_info("rmdir", self.plus_as_string(dir)); - fs::remove_dir(&self.plus(dir)).unwrap(); + fs::remove_dir(self.plus(dir)).unwrap(); } pub fn mkdir(&self, dir: &str) { log_info("mkdir", self.plus_as_string(dir)); - fs::create_dir(&self.plus(dir)).unwrap(); + fs::create_dir(self.plus(dir)).unwrap(); } pub fn mkdir_all(&self, dir: &str) { @@ -645,7 +645,7 @@ impl AtPath { } pub fn make_file(&self, name: &str) -> File { - match File::create(&self.plus(name)) { + match File::create(self.plus(name)) { Ok(f) => f, Err(e) => panic!("{}", e), } @@ -653,7 +653,7 @@ impl AtPath { pub fn touch(&self, file: &str) { log_info("touch", self.plus_as_string(file)); - File::create(&self.plus(file)).unwrap(); + File::create(self.plus(file)).unwrap(); } #[cfg(not(windows))] @@ -682,25 +682,25 @@ impl AtPath { pub fn hard_link(&self, original: &str, link: &str) { log_info( "hard_link", - &format!( + format!( "{},{}", self.plus_as_string(original), self.plus_as_string(link) ), ); - hard_link(&self.plus(original), &self.plus(link)).unwrap(); + hard_link(self.plus(original), self.plus(link)).unwrap(); } pub fn symlink_file(&self, original: &str, link: &str) { log_info( "symlink", - &format!( + format!( "{},{}", self.plus_as_string(original), self.plus_as_string(link) ), ); - symlink_file(&self.plus(original), &self.plus(link)).unwrap(); + symlink_file(self.plus(original), self.plus(link)).unwrap(); } pub fn relative_symlink_file(&self, original: &str, link: &str) { @@ -708,21 +708,21 @@ impl AtPath { let original = original.replace('/', &MAIN_SEPARATOR.to_string()); log_info( "symlink", - &format!("{},{}", &original, &self.plus_as_string(link)), + format!("{},{}", &original, &self.plus_as_string(link)), ); - symlink_file(original, &self.plus(link)).unwrap(); + symlink_file(original, self.plus(link)).unwrap(); } pub fn symlink_dir(&self, original: &str, link: &str) { log_info( "symlink", - &format!( + format!( "{},{}", self.plus_as_string(original), self.plus_as_string(link) ), ); - symlink_dir(&self.plus(original), &self.plus(link)).unwrap(); + symlink_dir(self.plus(original), self.plus(link)).unwrap(); } pub fn relative_symlink_dir(&self, original: &str, link: &str) { @@ -730,14 +730,14 @@ impl AtPath { let original = original.replace('/', &MAIN_SEPARATOR.to_string()); log_info( "symlink", - &format!("{},{}", &original, &self.plus_as_string(link)), + format!("{},{}", &original, &self.plus_as_string(link)), ); - symlink_dir(original, &self.plus(link)).unwrap(); + symlink_dir(original, self.plus(link)).unwrap(); } pub fn is_symlink(&self, path: &str) -> bool { log_info("is_symlink", self.plus_as_string(path)); - match fs::symlink_metadata(&self.plus(path)) { + match fs::symlink_metadata(self.plus(path)) { Ok(m) => m.file_type().is_symlink(), Err(_) => false, } @@ -745,7 +745,7 @@ impl AtPath { pub fn resolve_link(&self, path: &str) -> String { log_info("resolve_link", self.plus_as_string(path)); - match fs::read_link(&self.plus(path)) { + match fs::read_link(self.plus(path)) { Ok(p) => self.minus_as_string(p.to_str().unwrap()), Err(_) => "".to_string(), } @@ -753,7 +753,7 @@ impl AtPath { pub fn read_symlink(&self, path: &str) -> String { log_info("read_symlink", self.plus_as_string(path)); - fs::read_link(&self.plus(path)) + fs::read_link(self.plus(path)) .unwrap() .to_str() .unwrap() @@ -761,21 +761,21 @@ impl AtPath { } pub fn symlink_metadata(&self, path: &str) -> fs::Metadata { - match fs::symlink_metadata(&self.plus(path)) { + match fs::symlink_metadata(self.plus(path)) { Ok(m) => m, Err(e) => panic!("{}", e), } } pub fn metadata(&self, path: &str) -> fs::Metadata { - match fs::metadata(&self.plus(path)) { + match fs::metadata(self.plus(path)) { Ok(m) => m, Err(e) => panic!("{}", e), } } pub fn file_exists(&self, path: &str) -> bool { - match fs::metadata(&self.plus(path)) { + match fs::metadata(self.plus(path)) { Ok(m) => m.is_file(), Err(_) => false, } @@ -783,14 +783,14 @@ impl AtPath { /// Decide whether the named symbolic link exists in the test directory. pub fn symlink_exists(&self, path: &str) -> bool { - match fs::symlink_metadata(&self.plus(path)) { + match fs::symlink_metadata(self.plus(path)) { Ok(m) => m.file_type().is_symlink(), Err(_) => false, } } pub fn dir_exists(&self, path: &str) -> bool { - match fs::metadata(&self.plus(path)) { + match fs::metadata(self.plus(path)) { Ok(m) => m.is_dir(), Err(_) => false, } diff --git a/tests/test_util_name.rs b/tests/test_util_name.rs index 04b874b0b..bf0ea2fa3 100644 --- a/tests/test_util_name.rs +++ b/tests/test_util_name.rs @@ -52,7 +52,7 @@ fn util_name_double() { }; let scenario = TestScenario::new("sort"); - let mut child = Command::new(&scenario.bin_path) + let mut child = Command::new(scenario.bin_path) .arg("sort") .stdin(Stdio::piped()) .stderr(Stdio::piped())