Skip to content

Commit 6a828f0

Browse files
authored
Merge pull request #7957 from cakebaker/clippy_set_msrv_and_fix_warnings
clippy: set MSRV and fix warnings
2 parents 9fbb6ac + ee665fb commit 6a828f0

File tree

6 files changed

+23
-15
lines changed

6 files changed

+23
-15
lines changed

.clippy.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
msrv = "1.85.0"
12
avoid-breaking-exported-api = false
23
check-private-items = true
34
cognitive-complexity-threshold = 24

src/uu/cp/src/cp.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1259,13 +1259,17 @@ fn parse_path_args(
12591259
return Err("missing file operand".into());
12601260
} else if paths.len() == 1 && options.target_dir.is_none() {
12611261
// Only one file specified
1262-
return Err(format!("missing destination file operand after {:?}", paths[0]).into());
1262+
return Err(format!(
1263+
"missing destination file operand after {}",
1264+
paths[0].display().to_string().quote()
1265+
)
1266+
.into());
12631267
}
12641268

12651269
// Return an error if the user requested to copy more than one
12661270
// file source to a file target
12671271
if options.no_target_dir && options.target_dir.is_none() && paths.len() > 2 {
1268-
return Err(format!("extra operand {:?}", paths[2]).into());
1272+
return Err(format!("extra operand {:}", paths[2].display().to_string().quote()).into());
12691273
}
12701274

12711275
let target = match options.target_dir {

src/uu/cp/src/platform/macos.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,12 @@ pub(crate) fn copy_on_write(
8484
// support COW).
8585
match reflink_mode {
8686
ReflinkMode::Always => {
87-
return Err(format!("failed to clone {source:?} from {dest:?}: {error}").into());
87+
return Err(format!(
88+
"failed to clone {} from {}: {error}",
89+
source.display(),
90+
dest.display()
91+
)
92+
.into());
8893
}
8994
_ => {
9095
copy_debug.reflink = OffloadReflinkDebug::Yes;

src/uu/more/src/more.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -900,16 +900,15 @@ mod tests {
900900
if let Some(rows) = self.options.lines {
901901
self.rows = rows;
902902
}
903-
let pager = Pager::new(
903+
Pager::new(
904904
InputType::File(BufReader::new(tmpfile)),
905905
self.rows,
906906
None,
907907
self.next_file,
908908
&self.options,
909909
out,
910910
)
911-
.unwrap();
912-
pager
911+
.unwrap()
913912
}
914913

915914
fn silent(mut self) -> Self {

src/uu/mv/src/mv.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -826,7 +826,7 @@ fn rename_dir_fallback(
826826
io::ErrorKind::PermissionDenied,
827827
"Permission denied",
828828
)),
829-
_ => Err(io::Error::new(io::ErrorKind::Other, format!("{err:?}"))),
829+
_ => Err(io::Error::other(format!("{err:?}"))),
830830
},
831831
_ => Ok(()),
832832
}

tests/by-util/test_cp.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@
22
//
33
// For the full copyright and license information, please view the LICENSE
44
// file that was distributed with this source code.
5+
56
// spell-checker:ignore (flags) reflink (fs) tmpfs (linux) rlimit Rlim NOFILE clob btrfs neve ROOTDIR USERDIR procfs outfile uufs xattrs
67
// spell-checker:ignore bdfl hlsl IRWXO IRWXG nconfined matchpathcon libselinux-devel
7-
use uutests::at_and_ucmd;
8-
use uutests::new_ucmd;
9-
use uutests::path_concat;
8+
use uucore::display::Quotable;
109
use uutests::util::TestScenario;
11-
use uutests::util_name;
10+
use uutests::{at_and_ucmd, new_ucmd, path_concat, util_name};
1211

1312
#[cfg(not(windows))]
1413
use std::fs::set_permissions;
@@ -3946,10 +3945,10 @@ fn test_cp_only_source_no_target() {
39463945
let ts = TestScenario::new(util_name!());
39473946
let at = &ts.fixtures;
39483947
at.touch("a");
3949-
ts.ucmd()
3950-
.arg("a")
3951-
.fails()
3952-
.stderr_contains("missing destination file operand after \"a\"");
3948+
ts.ucmd().arg("a").fails().stderr_contains(format!(
3949+
"missing destination file operand after {}",
3950+
"a".quote()
3951+
));
39533952
}
39543953

39553954
#[test]

0 commit comments

Comments
 (0)