mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 19:47:45 +00:00
Merge pull request #1715 from sylvestre/clippy-fix2
Fix some clippy warnings
This commit is contained in:
commit
749c794bf6
4 changed files with 9 additions and 12 deletions
|
@ -495,7 +495,7 @@ fn copy(from: &PathBuf, to: &PathBuf, b: &Behavior) -> Result<(), ()> {
|
|||
return Err(());
|
||||
}
|
||||
|
||||
if b.owner != "" {
|
||||
if !b.owner.is_empty() {
|
||||
let meta = match fs::metadata(to) {
|
||||
Ok(meta) => meta,
|
||||
Err(f) => crash!(1, "{}", f.to_string()),
|
||||
|
@ -515,7 +515,7 @@ fn copy(from: &PathBuf, to: &PathBuf, b: &Behavior) -> Result<(), ()> {
|
|||
Verbosity::Normal,
|
||||
) {
|
||||
Ok(n) => {
|
||||
if n != "" {
|
||||
if !n.is_empty() {
|
||||
show_info!("{}", n);
|
||||
}
|
||||
}
|
||||
|
@ -523,7 +523,7 @@ fn copy(from: &PathBuf, to: &PathBuf, b: &Behavior) -> Result<(), ()> {
|
|||
}
|
||||
}
|
||||
|
||||
if b.group != "" {
|
||||
if !b.group.is_empty() {
|
||||
let meta = match fs::metadata(to) {
|
||||
Ok(meta) => meta,
|
||||
Err(f) => crash!(1, "{}", f.to_string()),
|
||||
|
@ -535,7 +535,7 @@ fn copy(from: &PathBuf, to: &PathBuf, b: &Behavior) -> Result<(), ()> {
|
|||
};
|
||||
match wrap_chgrp(to.as_path(), &meta, group_id, false, Verbosity::Normal) {
|
||||
Ok(n) => {
|
||||
if n != "" {
|
||||
if !n.is_empty() {
|
||||
show_info!("{}", n);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -325,9 +325,8 @@ fn link_files_in_dir(files: &[PathBuf], target_dir: &PathBuf, settings: &Setting
|
|||
// Not sure why but on Windows, the symlink can be
|
||||
// considered as a dir
|
||||
// See test_ln::test_symlink_no_deref_dir
|
||||
match fs::remove_dir(target_dir) {
|
||||
Err(e) => show_error!("Could not update {}: {}", target_dir.display(), e),
|
||||
_ => (),
|
||||
if let Err(e) = fs::remove_dir(target_dir) {
|
||||
show_error!("Could not update {}: {}", target_dir.display(), e)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -75,9 +75,7 @@ impl FilterWriter {
|
|||
.spawn()
|
||||
.expect("Couldn't spawn filter command");
|
||||
|
||||
FilterWriter {
|
||||
shell_process: shell_process,
|
||||
}
|
||||
FilterWriter { shell_process }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -163,7 +163,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
|
|||
|
||||
match matches.value_of(OPT_LINES) {
|
||||
Some(n) => {
|
||||
let mut slice: &str = n.as_ref();
|
||||
let mut slice: &str = n;
|
||||
if slice.chars().next().unwrap_or('_') == '+' {
|
||||
settings.beginning = true;
|
||||
slice = &slice[1..];
|
||||
|
@ -178,7 +178,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
|
|||
}
|
||||
None => {
|
||||
if let Some(n) = matches.value_of(OPT_BYTES) {
|
||||
let mut slice: &str = n.as_ref();
|
||||
let mut slice: &str = n;
|
||||
if slice.chars().next().unwrap_or('_') == '+' {
|
||||
settings.beginning = true;
|
||||
slice = &slice[1..];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue