diff options
Diffstat (limited to 'src/path.rs')
-rw-r--r-- | src/path.rs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/path.rs b/src/path.rs index 05a9caa..1000b04 100644 --- a/src/path.rs +++ b/src/path.rs @@ -9,14 +9,14 @@ pub enum PathMatcher { } impl Parser for PathMatcher { - #[tracing::instrument] - fn parse(&self, path_buf: PathBuf) -> Result<Project, Box<dyn std::error::Error>> { - let project = match self { - PathMatcher::All => path_buf.try_into()?, - PathMatcher::Pattern(p) if path_buf.join(p).exists() => path_buf.try_into()?, - _ => return Err(Box::new(std::io::Error::from(ErrorKind::NotFound))), - }; + type Error = std::io::Error; - Ok(project) + #[tracing::instrument] + fn parse(&self, path_buf: PathBuf) -> Result<Project, Self::Error> { + match self { + PathMatcher::All => path_buf.try_into(), + PathMatcher::Pattern(p) if path_buf.join(p).exists() => path_buf.try_into(), + _ => Err(std::io::Error::from(ErrorKind::NotFound)), + } } } |