From ae0a56cdffa515ed6bb7cb566c025cc66ff00f33 Mon Sep 17 00:00:00 2001 From: Laurenz Date: Tue, 15 Mar 2022 11:30:13 +0100 Subject: Non-returning error macro --- src/eval/mod.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'src/eval/mod.rs') diff --git a/src/eval/mod.rs b/src/eval/mod.rs index e00a40f2..4ccf377b 100644 --- a/src/eval/mod.rs +++ b/src/eval/mod.rs @@ -37,7 +37,7 @@ pub use value::*; use unicode_segmentation::UnicodeSegmentation; -use crate::diag::{At, Error, StrResult, Trace, Tracepoint, TypResult}; +use crate::diag::{At, StrResult, Trace, Tracepoint, TypResult}; use crate::geom::{Angle, Fractional, Length, Relative}; use crate::library; use crate::syntax::ast::*; @@ -725,11 +725,9 @@ impl Eval for IncludeExpr { fn import(ctx: &mut Context, path: &str, span: Span) -> TypResult { // Load the source file. let full = ctx.resolve(path); - let id = ctx.sources.load(&full).map_err(|err| { - Error::boxed(span, match err.kind() { - std::io::ErrorKind::NotFound => "file not found".into(), - _ => format!("failed to load source file ({})", err), - }) + let id = ctx.sources.load(&full).map_err(|err| match err.kind() { + std::io::ErrorKind::NotFound => error!(span, "file not found"), + _ => error!(span, "failed to load source file ({})", err), })?; // Prevent cyclic importing. -- cgit v1.2.3