From 5ce2a006b6d45d29be15e4562ae3ab4fc1b8e97c Mon Sep 17 00:00:00 2001 From: Laurenz Date: Fri, 11 Mar 2022 12:22:27 +0100 Subject: Consistent block naming --- src/eval/value.rs | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) (limited to 'src/eval/value.rs') diff --git a/src/eval/value.rs b/src/eval/value.rs index 009a1463..7d41bff5 100644 --- a/src/eval/value.rs +++ b/src/eval/value.rs @@ -5,7 +5,7 @@ use std::hash::{Hash, Hasher}; use std::sync::Arc; use super::{ops, Args, Array, Class, Dict, Func, Layout, Template}; -use crate::diag::StrResult; +use crate::diag::{with_alternative, StrResult}; use crate::geom::{Angle, Color, Fractional, Length, Linear, Relative, RgbaColor}; use crate::syntax::Spanned; use crate::util::EcoString; @@ -533,16 +533,6 @@ impl Cast for Smart { } } -/// Transform `expected X, found Y` into `expected X or A, found Y`. -pub fn with_alternative(msg: String, alt: &str) -> String { - let mut parts = msg.split(", found "); - if let (Some(a), Some(b)) = (parts.next(), parts.next()) { - format!("{} or {}, found {}", a, alt, b) - } else { - msg - } -} - #[cfg(test)] mod tests { use super::*; -- cgit v1.2.3