From 093e58de2ffc8243e6ff929f50a2aaa6ef60848b Mon Sep 17 00:00:00 2001 From: Melody Horn Date: Thu, 1 Apr 2021 17:44:50 -0600 Subject: slightly fancier errors --- src/makefile/macro.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/makefile/macro.rs') 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 {} +pub trait LookupInternal: for<'a> Fn(&'a str) -> Result {} -impl Fn(&'a str) -> anyhow::Result> LookupInternal for F {} +impl Fn(&'a str) -> Result> 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 { + fn lookup_internal(&self, name: &str) -> Result { 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 { + pub fn expand(&self, text: &TokenString) -> Result { let mut result = String::new(); for token in text.tokens() { match token { -- cgit v1.2.3