accepting review suggestions

This commit is contained in:
Bruno Ortiz 2023-04-13 13:06:43 -03:00
parent c372fb3495
commit 66fe84d936
13 changed files with 67 additions and 97 deletions

View file

@ -184,6 +184,13 @@ impl AbsPath {
self.0.ends_with(&suffix.0)
}
pub fn name_and_extension(&self) -> Option<(&str, Option<&str>)> {
Some((
self.file_stem()?.to_str()?,
self.extension().and_then(|extension| extension.to_str()),
))
}
// region:delegate-methods
// Note that we deliberately don't implement `Deref<Target = Path>` here.
@ -213,13 +220,6 @@ impl AbsPath {
pub fn exists(&self) -> bool {
self.0.exists()
}
pub fn name_and_extension(&self) -> Option<(&str, Option<&str>)> {
Some((
self.file_stem()?.to_str()?,
self.extension().and_then(|extension| extension.to_str()),
))
}
// endregion:delegate-methods
}