diff options
author | Toby Vincent <tobyv13@gmail.com> | 2023-05-05 18:42:37 -0500 |
---|---|---|
committer | Toby Vincent <tobyv13@gmail.com> | 2023-05-05 18:42:37 -0500 |
commit | e554e7033320456762a82b8276e0137592d57dcb (patch) | |
tree | 485ce88171b3aa890806973b0eb0227b889effc5 /src/path.rs | |
parent | 5da4fb25f9bb72771c7f2798daa6339be0bc3900 (diff) |
refactor: rewrite project layout
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)), + } } } |