diff --git a/tests/by-util/test_cp.rs b/tests/by-util/test_cp.rs index 27c996f1b..86fbf9dcc 100644 --- a/tests/by-util/test_cp.rs +++ b/tests/by-util/test_cp.rs @@ -1621,13 +1621,13 @@ fn test_cp_one_file_system() { use walkdir::WalkDir; let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; // Test must be run as root (or with `sudo -E`) if scene.cmd("whoami").run().stdout_str() != "root\n" { return; } - let at = scene.fixtures.clone(); let at_src = AtPath::new(&at.plus(TEST_MOUNT_COPY_FROM_FOLDER)); let at_dst = AtPath::new(&at.plus(TEST_COPY_TO_FOLDER_NEW)); diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index 61f6d8d8d..d460952ed 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -1239,7 +1239,7 @@ fn test_ls_long_total_size() { ("long_si", "total 8.2k"), ] .iter() - .cloned() + .copied() .collect() } else { [ @@ -1248,7 +1248,7 @@ fn test_ls_long_total_size() { ("long_si", "total 2"), ] .iter() - .cloned() + .copied() .collect() }; diff --git a/tests/by-util/test_pwd.rs b/tests/by-util/test_pwd.rs index 5719e87d2..076e72089 100644 --- a/tests/by-util/test_pwd.rs +++ b/tests/by-util/test_pwd.rs @@ -27,7 +27,7 @@ fn test_deleted_dir() { use std::process::Command; let ts = TestScenario::new(util_name!()); - let at = ts.fixtures.clone(); + let at = ts.fixtures; let output = Command::new("sh") .arg("-c") .arg(format!( diff --git a/tests/by-util/test_tee.rs b/tests/by-util/test_tee.rs index 946c60d0a..51d552d67 100644 --- a/tests/by-util/test_tee.rs +++ b/tests/by-util/test_tee.rs @@ -118,9 +118,10 @@ mod linux_only { use std::os::unix::io::FromRawFd; let mut fds: [c_int; 2] = [0, 0]; - if unsafe { libc::pipe(&mut fds as *mut c_int) } != 0 { - panic!("Failed to create pipe"); - } + assert!( + (unsafe { libc::pipe(&mut fds as *mut c_int) } == 0), + "Failed to create pipe" + ); // Drop the read end of the pipe let _ = unsafe { File::from_raw_fd(fds[0]) }; diff --git a/tests/by-util/test_yes.rs b/tests/by-util/test_yes.rs index 9f03780b7..c054a6e5f 100644 --- a/tests/by-util/test_yes.rs +++ b/tests/by-util/test_yes.rs @@ -6,12 +6,12 @@ use std::os::unix::process::ExitStatusExt; use crate::common::util::TestScenario; #[cfg(unix)] -fn check_termination(result: &ExitStatus) { +fn check_termination(result: ExitStatus) { assert_eq!(result.signal(), Some(libc::SIGPIPE)); } #[cfg(not(unix))] -fn check_termination(result: &ExitStatus) { +fn check_termination(result: ExitStatus) { assert!(result.success(), "yes did not exit successfully"); } @@ -23,7 +23,7 @@ fn run(args: &[&str], expected: &[u8]) { child.close_stdout(); #[allow(deprecated)] - check_termination(&child.wait_with_output().unwrap().status); + check_termination(child.wait_with_output().unwrap().status); assert_eq!(buf.as_slice(), expected); } diff --git a/tests/common/util.rs b/tests/common/util.rs index 5d72a7abf..0898a4ad7 100644 --- a/tests/common/util.rs +++ b/tests/common/util.rs @@ -2016,7 +2016,7 @@ impl UChild { /// Read, consume and return the output as [`String`] from [`Child`]'s stdout. /// - /// See also [`UChild::stdout_bytes] for side effects. + /// See also [`UChild::stdout_bytes`] for side effects. pub fn stdout(&mut self) -> String { String::from_utf8(self.stdout_bytes()).unwrap() }