mirror of https://github.com/sharkdp/fd.git
Fix some clippy warnings
This commit is contained in:
parent
b29e87ec30
commit
6e5c8d9c20
|
@ -5,13 +5,13 @@ use crate::filesystem::strip_current_dir;
|
|||
|
||||
/// Removes the parent component of the path
|
||||
pub fn basename(path: &Path) -> &OsStr {
|
||||
path.file_name().unwrap_or_else(|| path.as_os_str())
|
||||
path.file_name().unwrap_or(path.as_os_str())
|
||||
}
|
||||
|
||||
/// Removes the extension from the path
|
||||
pub fn remove_extension(path: &Path) -> OsString {
|
||||
let dirname = dirname(path);
|
||||
let stem = path.file_stem().unwrap_or_else(|| path.as_os_str());
|
||||
let stem = path.file_stem().unwrap_or(path.as_os_str());
|
||||
|
||||
let path = PathBuf::from(dirname).join(stem);
|
||||
|
||||
|
|
|
@ -112,7 +112,7 @@ fn ensure_current_directory_exists(current_directory: &Path) -> Result<()> {
|
|||
}
|
||||
}
|
||||
|
||||
fn extract_search_pattern<'a>(matches: &'a clap::ArgMatches) -> Result<&'a str> {
|
||||
fn extract_search_pattern(matches: &clap::ArgMatches) -> Result<&'_ str> {
|
||||
let pattern = matches
|
||||
.value_of_os("pattern")
|
||||
.map(|p| {
|
||||
|
|
10
src/walk.rs
10
src/walk.rs
|
@ -104,10 +104,7 @@ pub fn scan(path_vec: &[PathBuf], pattern: Arc<Regex>, config: Arc<Config>) -> R
|
|||
match result {
|
||||
Some(ignore::Error::Partial(_)) => (),
|
||||
Some(err) => {
|
||||
print_error(format!(
|
||||
"Malformed pattern in global ignore file. {}.",
|
||||
err.to_string()
|
||||
));
|
||||
print_error(format!("Malformed pattern in global ignore file. {}.", err));
|
||||
}
|
||||
None => (),
|
||||
}
|
||||
|
@ -119,10 +116,7 @@ pub fn scan(path_vec: &[PathBuf], pattern: Arc<Regex>, config: Arc<Config>) -> R
|
|||
match result {
|
||||
Some(ignore::Error::Partial(_)) => (),
|
||||
Some(err) => {
|
||||
print_error(format!(
|
||||
"Malformed pattern in custom ignore file. {}.",
|
||||
err.to_string()
|
||||
));
|
||||
print_error(format!("Malformed pattern in custom ignore file. {}.", err));
|
||||
}
|
||||
None => (),
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue