diff --git a/src/file.rs b/src/file.rs index 3c03231..52f8ee6 100644 --- a/src/file.rs +++ b/src/file.rs @@ -40,10 +40,7 @@ impl TryFrom for FileNameInfo { match file_name.rsplit_once(b'.').filter(|(_, ending)| { //there are usually no file extensions which are just a number, but rather versions // -> don't use split if ending is number - match ending.to_str() { - Some(ending) if ending.parse::().is_ok() => false, - _ => true, - } + !matches!(ending.to_str(), Some(ending) if ending.parse::().is_ok()) }) { Some((name, ending)) => (name, Some(ending.to_os_string())), None => (file_name, None), @@ -75,14 +72,12 @@ impl Display for FileNameInfo { #[derive(Debug)] pub enum FileInfoError { NotAFile, - InvalidCharactersInFileName, } impl Display for FileInfoError { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { match self { FileInfoError::NotAFile => write!(f, "Path doesn't point to a file"), - FileInfoError::InvalidCharactersInFileName => write!(f, "Invalid characters in file name"), } } }