mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-27 19:17:43 +00:00
cp: fix warnings from unnecessary_debug_formatting
Co-authored-by: Jeremy Smart <jeremy3141592@gmail.com>
This commit is contained in:
parent
7a706b5756
commit
8674e86703
3 changed files with 19 additions and 11 deletions
|
@ -1259,13 +1259,17 @@ fn parse_path_args(
|
|||
return Err("missing file operand".into());
|
||||
} else if paths.len() == 1 && options.target_dir.is_none() {
|
||||
// Only one file specified
|
||||
return Err(format!("missing destination file operand after {:?}", paths[0]).into());
|
||||
return Err(format!(
|
||||
"missing destination file operand after {}",
|
||||
paths[0].display().to_string().quote()
|
||||
)
|
||||
.into());
|
||||
}
|
||||
|
||||
// Return an error if the user requested to copy more than one
|
||||
// file source to a file target
|
||||
if options.no_target_dir && options.target_dir.is_none() && paths.len() > 2 {
|
||||
return Err(format!("extra operand {:?}", paths[2]).into());
|
||||
return Err(format!("extra operand {:}", paths[2].display().to_string().quote()).into());
|
||||
}
|
||||
|
||||
let target = match options.target_dir {
|
||||
|
|
|
@ -84,7 +84,12 @@ pub(crate) fn copy_on_write(
|
|||
// support COW).
|
||||
match reflink_mode {
|
||||
ReflinkMode::Always => {
|
||||
return Err(format!("failed to clone {source:?} from {dest:?}: {error}").into());
|
||||
return Err(format!(
|
||||
"failed to clone {} from {}: {error}",
|
||||
source.display(),
|
||||
dest.display()
|
||||
)
|
||||
.into());
|
||||
}
|
||||
_ => {
|
||||
copy_debug.reflink = OffloadReflinkDebug::Yes;
|
||||
|
|
|
@ -2,13 +2,12 @@
|
|||
//
|
||||
// For the full copyright and license information, please view the LICENSE
|
||||
// file that was distributed with this source code.
|
||||
|
||||
// spell-checker:ignore (flags) reflink (fs) tmpfs (linux) rlimit Rlim NOFILE clob btrfs neve ROOTDIR USERDIR procfs outfile uufs xattrs
|
||||
// spell-checker:ignore bdfl hlsl IRWXO IRWXG nconfined matchpathcon libselinux-devel
|
||||
use uutests::at_and_ucmd;
|
||||
use uutests::new_ucmd;
|
||||
use uutests::path_concat;
|
||||
use uucore::display::Quotable;
|
||||
use uutests::util::TestScenario;
|
||||
use uutests::util_name;
|
||||
use uutests::{at_and_ucmd, new_ucmd, path_concat, util_name};
|
||||
|
||||
#[cfg(not(windows))]
|
||||
use std::fs::set_permissions;
|
||||
|
@ -3946,10 +3945,10 @@ fn test_cp_only_source_no_target() {
|
|||
let ts = TestScenario::new(util_name!());
|
||||
let at = &ts.fixtures;
|
||||
at.touch("a");
|
||||
ts.ucmd()
|
||||
.arg("a")
|
||||
.fails()
|
||||
.stderr_contains("missing destination file operand after \"a\"");
|
||||
ts.ucmd().arg("a").fails().stderr_contains(format!(
|
||||
"missing destination file operand after {}",
|
||||
"a".quote()
|
||||
));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue