Merge pull request #4108 from cakebaker/rm_fix_clippy_warnings

Fix clippy warnings
This commit is contained in:
Sylvestre Ledru 2022-11-04 12:54:10 +01:00 committed by GitHub
commit 2af01ec344
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 8 deletions

View file

@ -475,11 +475,11 @@ fn rename_symlink_fallback(from: &Path, to: &Path) -> io::Result<()> {
{ {
if path_symlink_points_to.exists() { if path_symlink_points_to.exists() {
if path_symlink_points_to.is_dir() { if path_symlink_points_to.is_dir() {
windows::fs::symlink_dir(&path_symlink_points_to, &to)?; windows::fs::symlink_dir(&path_symlink_points_to, to)?;
} else { } else {
windows::fs::symlink_file(&path_symlink_points_to, &to)?; windows::fs::symlink_file(&path_symlink_points_to, to)?;
} }
fs::remove_file(&from)?; fs::remove_file(from)?;
} else { } else {
return Err(io::Error::new( return Err(io::Error::new(
io::ErrorKind::NotFound, io::ErrorKind::NotFound,

View file

@ -170,7 +170,7 @@ pub fn uu_app() -> Command {
Arg::new(OPT_PROMPT) Arg::new(OPT_PROMPT)
.short('i') .short('i')
.help("prompt before every removal") .help("prompt before every removal")
.overrides_with_all(&[OPT_PROMPT_MORE, OPT_INTERACTIVE]) .overrides_with_all([OPT_PROMPT_MORE, OPT_INTERACTIVE])
.action(ArgAction::SetTrue), .action(ArgAction::SetTrue),
) )
.arg( .arg(
@ -178,7 +178,7 @@ pub fn uu_app() -> Command {
.short('I') .short('I')
.help("prompt once before removing more than three files, or when removing recursively. \ .help("prompt once before removing more than three files, or when removing recursively. \
Less intrusive than -i, while still giving some protection against most mistakes") Less intrusive than -i, while still giving some protection against most mistakes")
.overrides_with_all(&[OPT_PROMPT, OPT_INTERACTIVE]) .overrides_with_all([OPT_PROMPT, OPT_INTERACTIVE])
.action(ArgAction::SetTrue), .action(ArgAction::SetTrue),
) )
.arg( .arg(
@ -189,7 +189,7 @@ pub fn uu_app() -> Command {
prompts always", prompts always",
) )
.value_name("WHEN") .value_name("WHEN")
.overrides_with_all(&[OPT_PROMPT, OPT_PROMPT_MORE]), .overrides_with_all([OPT_PROMPT, OPT_PROMPT_MORE]),
) )
.arg( .arg(
Arg::new(OPT_ONE_FILE_SYSTEM) Arg::new(OPT_ONE_FILE_SYSTEM)

View file

@ -303,7 +303,7 @@ impl MountInfo {
let mut mn_info = Self { let mut mn_info = Self {
dev_id: volume_name, dev_id: volume_name,
dev_name, dev_name,
fs_type: fs_type.unwrap_or_else(|| "".to_string()), fs_type: fs_type.unwrap_or_default(),
mount_root, mount_root,
mount_dir: "".to_string(), mount_dir: "".to_string(),
mount_option: "".to_string(), mount_option: "".to_string(),

View file

@ -220,7 +220,7 @@ fn test_change_directory() {
let out = scene let out = scene
.ucmd() .ucmd()
.arg("--chdir") .arg("--chdir")
.arg(&temporary_path) .arg(temporary_path)
.args(&pwd) .args(&pwd)
.succeeds() .succeeds()
.stdout_move_str(); .stdout_move_str();