diff --git a/src/cli.rs b/src/cli.rs index 81aa151..4eb31f6 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -52,10 +52,7 @@ pub struct ParsedArgs { /// check_for_typo checks if the first argument is /// a typo for the compress subcommand. /// Returns true if the arg is probably a typo or false otherwise. -fn is_typo<'a, P>(path: P) -> bool -where - P: AsRef + 'a, -{ +fn is_typo(path: impl AsRef) -> bool { if path.as_ref().exists() { // If the file exists then we won't check for a typo return false; @@ -66,10 +63,7 @@ where normalized_damerau_levenshtein("compress", &path) > 0.625 } -fn canonicalize<'a, P>(path: P) -> crate::Result -where - P: AsRef + 'a, -{ +fn canonicalize(path: impl AsRef) -> crate::Result { match std::fs::canonicalize(&path.as_ref()) { Ok(abs_path) => Ok(abs_path), Err(io_err) => { @@ -82,11 +76,8 @@ where } } -fn canonicalize_files<'a, P>(files: &[P]) -> crate::Result> -where - P: AsRef + 'a, -{ - files.into_iter().map(canonicalize).collect() +fn canonicalize_files(files: &[impl AsRef]) -> crate::Result> { + files.iter().map(canonicalize).collect() } pub fn parse_args_from(mut args: Vec) -> crate::Result { diff --git a/src/utils.rs b/src/utils.rs index fb9a53f..ddc6745 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -23,10 +23,7 @@ macro_rules! debug { }; } -pub fn ensure_exists<'a, P>(path: P) -> crate::Result<()> -where - P: AsRef + 'a, -{ +pub fn ensure_exists(path: impl AsRef) -> crate::Result<()> { let exists = path.as_ref().exists(); if !exists { return Err(crate::Error::FileNotFound(PathBuf::from(path.as_ref())));