Remove unused FileInfoError variant
This commit is contained in:
parent
a288bf58a5
commit
744fd0f6c2
@ -40,10 +40,7 @@ impl TryFrom<PathBuf> for FileNameInfo {
|
|||||||
match file_name.rsplit_once(b'.').filter(|(_, ending)| {
|
match file_name.rsplit_once(b'.').filter(|(_, ending)| {
|
||||||
//there are usually no file extensions which are just a number, but rather versions
|
//there are usually no file extensions which are just a number, but rather versions
|
||||||
// -> don't use split if ending is number
|
// -> don't use split if ending is number
|
||||||
match ending.to_str() {
|
!matches!(ending.to_str(), Some(ending) if ending.parse::<u32>().is_ok())
|
||||||
Some(ending) if ending.parse::<u32>().is_ok() => false,
|
|
||||||
_ => true,
|
|
||||||
}
|
|
||||||
}) {
|
}) {
|
||||||
Some((name, ending)) => (name, Some(ending.to_os_string())),
|
Some((name, ending)) => (name, Some(ending.to_os_string())),
|
||||||
None => (file_name, None),
|
None => (file_name, None),
|
||||||
@ -75,14 +72,12 @@ impl Display for FileNameInfo {
|
|||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub enum FileInfoError {
|
pub enum FileInfoError {
|
||||||
NotAFile,
|
NotAFile,
|
||||||
InvalidCharactersInFileName,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Display for FileInfoError {
|
impl Display for FileInfoError {
|
||||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||||
match self {
|
match self {
|
||||||
FileInfoError::NotAFile => write!(f, "Path doesn't point to a file"),
|
FileInfoError::NotAFile => write!(f, "Path doesn't point to a file"),
|
||||||
FileInfoError::InvalidCharactersInFileName => write!(f, "Invalid characters in file name"),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user