summaryrefslogtreecommitdiffstats
path: root/src/path.rs
diff options
context:
space:
mode:
authorToby Vincent <tobyv13@gmail.com>2023-05-05 18:42:37 -0500
committerToby Vincent <tobyv13@gmail.com>2023-05-05 18:42:37 -0500
commite554e7033320456762a82b8276e0137592d57dcb (patch)
tree485ce88171b3aa890806973b0eb0227b889effc5 /src/path.rs
parent5da4fb25f9bb72771c7f2798daa6339be0bc3900 (diff)
refactor: rewrite project layout
Diffstat (limited to 'src/path.rs')
-rw-r--r--src/path.rs16
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)),
+ }
}
}