diff --git a/src/uu/cp/src/copydir.rs b/src/uu/cp/src/copydir.rs index 3b04114e6..931217d92 100644 --- a/src/uu/cp/src/copydir.rs +++ b/src/uu/cp/src/copydir.rs @@ -213,7 +213,7 @@ where // `path.ends_with(".")` does not seem to work path.as_ref().display().to_string().ends_with("/.") } - +#[allow(clippy::too_many_arguments)] /// Copy a single entry during a directory traversal. fn copy_direntry( progress_bar: &Option, @@ -326,6 +326,7 @@ fn copy_direntry( /// /// Any errors encountered copying files in the tree will be logged but /// will not cause a short-circuit. +#[allow(clippy::too_many_arguments)] pub(crate) fn copy_directory( progress_bar: &Option, root: &Path, diff --git a/src/uu/cp/src/cp.rs b/src/uu/cp/src/cp.rs index 608bc11f1..69577a012 100644 --- a/src/uu/cp/src/cp.rs +++ b/src/uu/cp/src/cp.rs @@ -1272,7 +1272,7 @@ fn construct_dest_path( TargetType::File => target.to_path_buf(), }) } - +#[allow(clippy::too_many_arguments)] fn copy_source( progress_bar: &Option, source: &Path, @@ -1914,7 +1914,7 @@ fn calculate_dest_permissions( /// /// The original permissions of `source` will be copied to `dest` /// after a successful copy. -#[allow(clippy::cognitive_complexity)] +#[allow(clippy::cognitive_complexity, clippy::too_many_arguments)] fn copy_file( progress_bar: &Option, source: &Path, diff --git a/tests/by-util/test_cp.rs b/tests/by-util/test_cp.rs index 2aacfeca9..f9ff5583d 100644 --- a/tests/by-util/test_cp.rs +++ b/tests/by-util/test_cp.rs @@ -2667,9 +2667,6 @@ fn test_cp_symlink_overwrite_detection() { at.mkdir("good"); at.mkdir("tmp"); - at.touch("README"); - at.touch("good/README"); - at.write("README", "file1"); at.write("good/README", "file2"); @@ -2681,18 +2678,18 @@ fn test_cp_symlink_overwrite_detection() { at.touch("tmp/foo"); - let result = ts - .ucmd() + ts.ucmd() .arg("README") .arg("good/README") .arg("tmp") - .fails(); - let stderr = result.stderr_str(); - - assert_eq!( - "cp: will not copy 'good/README' through just-created symlink 'tmp/README'\n", - stderr - ); + .fails() + .stderr_only(if cfg!(target_os = "windows") { + "cp: will not copy 'good/README' through just-created symlink 'tmp\\README'\n" + } else if cfg!(target_os = "macos") { + "cp: will not overwrite just-created 'tmp/README' with 'good/README'\n" + } else { + "cp: will not copy 'good/README' through just-created symlink 'tmp/README'\n" + }); let contents = at.read("tmp/foo"); assert_eq!(contents, "file1"); }