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/macro.rs | |
parent | e1128fe55d91ca60086de45c911b4568d2eec9ee (diff) | |
download | makers-093e58de2ffc8243e6ff929f50a2aaa6ef60848b.tar.gz makers-093e58de2ffc8243e6ff929f50a2aaa6ef60848b.zip |
slightly fancier errors
Diffstat (limited to 'src/makefile/macro.rs')
-rw-r--r-- | src/makefile/macro.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/makefile/macro.rs b/src/makefile/macro.rs index f18060f..e760282 100644 --- a/src/makefile/macro.rs +++ b/src/makefile/macro.rs @@ -2,7 +2,7 @@ use std::collections::HashMap; use std::env; use std::fmt; -use anyhow::Context; +use eyre::{bail, Result, WrapErr}; use regex::Regex; use super::functions; @@ -16,9 +16,9 @@ pub enum Source { Builtin, } -pub trait LookupInternal: for<'a> Fn(&'a str) -> anyhow::Result<String> {} +pub trait LookupInternal: for<'a> Fn(&'a str) -> Result<String> {} -impl<F: for<'a> Fn(&'a str) -> anyhow::Result<String>> LookupInternal for F {} +impl<F: for<'a> Fn(&'a str) -> Result<String>> LookupInternal for F {} #[derive(Clone)] pub struct Set<'parent, 'lookup> { @@ -51,13 +51,13 @@ impl<'parent, 'lookup> Set<'parent, 'lookup> { } } - fn lookup_internal(&self, name: &str) -> anyhow::Result<String> { + fn lookup_internal(&self, name: &str) -> Result<String> { if let Some(lookup) = self.lookup_internal { lookup(name) } else if let Some(parent) = self.parent { parent.lookup_internal(name) } else { - anyhow::bail!("no lookup possible") + bail!("no lookup possible") } } @@ -80,7 +80,7 @@ impl<'parent, 'lookup> Set<'parent, 'lookup> { self.data.remove(name) } - pub fn expand(&self, text: &TokenString) -> anyhow::Result<String> { + pub fn expand(&self, text: &TokenString) -> Result<String> { let mut result = String::new(); for token in text.tokens() { match token { |