mirror of
https://github.com/uutils/coreutils
synced 2024-12-14 15:22:38 +00:00
Merge pull request #4759 from sylvestre/clippy4
fix some clippy warnings in tests
This commit is contained in:
commit
98fa941250
6 changed files with 12 additions and 11 deletions
|
@ -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));
|
||||
|
||||
|
|
|
@ -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()
|
||||
};
|
||||
|
||||
|
|
|
@ -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!(
|
||||
|
|
|
@ -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]) };
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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()
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue