diff options
author | Melody Horn <melody@boringcactus.com> | 2021-04-01 17:44:50 -0600 |
---|---|---|
committer | Melody Horn <melody@boringcactus.com> | 2021-04-01 17:44:50 -0600 |
commit | 093e58de2ffc8243e6ff929f50a2aaa6ef60848b (patch) | |
tree | be2003c6fd8d774f9462f4c0bd2ddae2af92f238 /src/makefile/pattern.rs | |
parent | e1128fe55d91ca60086de45c911b4568d2eec9ee (diff) | |
download | makers-093e58de2ffc8243e6ff929f50a2aaa6ef60848b.tar.gz makers-093e58de2ffc8243e6ff929f50a2aaa6ef60848b.zip |
slightly fancier errors
Diffstat (limited to 'src/makefile/pattern.rs')
-rw-r--r-- | src/makefile/pattern.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/makefile/pattern.rs b/src/makefile/pattern.rs index 6648851..b47c75d 100644 --- a/src/makefile/pattern.rs +++ b/src/makefile/pattern.rs @@ -1,6 +1,7 @@ +use eyre::Result; use regex::{Captures, Regex}; -fn compile_pattern(pattern: &str) -> anyhow::Result<Regex> { +fn compile_pattern(pattern: &str) -> Result<Regex> { let mut result = String::new(); for c in pattern.chars() { if c == '%' { @@ -24,7 +25,7 @@ fn compile_pattern(pattern: &str) -> anyhow::Result<Regex> { Ok(Regex::new(&result)?) } -pub fn r#match<'a>(pattern: &str, text: &'a str) -> anyhow::Result<Option<Captures<'a>>> { +pub fn r#match<'a>(pattern: &str, text: &'a str) -> Result<Option<Captures<'a>>> { Ok(compile_pattern(pattern)?.captures(text)) } @@ -32,7 +33,7 @@ pub fn r#match<'a>(pattern: &str, text: &'a str) -> anyhow::Result<Option<Captur mod test { use super::*; - type R = anyhow::Result<()>; + type R = Result<()>; #[test] fn pattern_backslashes() -> R { |