summaryrefslogtreecommitdiff
path: root/src/model
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2023-03-01 11:27:10 +0100
committerLaurenz <laurmaedje@gmail.com>2023-03-01 11:27:10 +0100
commitab841188e3d2687ee8f436336e6fde337985a83e (patch)
tree23504e66ea84e62e4354fa76ac199fc1ff658e8a /src/model
parent8f246406c61f3710fa6659e85d7c715b001ea05d (diff)
Bump `ecow`
Diffstat (limited to 'src/model')
-rw-r--r--src/model/array.rs8
-rw-r--r--src/model/dict.rs8
-rw-r--r--src/model/module.rs4
-rw-r--r--src/model/ops.rs6
-rw-r--r--src/model/str.rs10
-rw-r--r--src/model/value.rs12
6 files changed, 24 insertions, 24 deletions
diff --git a/src/model/array.rs b/src/model/array.rs
index 0a84072d..746763ab 100644
--- a/src/model/array.rs
+++ b/src/model/array.rs
@@ -2,7 +2,7 @@ use std::cmp::Ordering;
use std::fmt::{self, Debug, Formatter, Write};
use std::ops::{Add, AddAssign};
-use ecow::{format_eco, EcoString, EcoVec};
+use ecow::{eco_format, EcoString, EcoVec};
use super::{ops, Args, Func, Value, Vm};
use crate::diag::{bail, At, SourceResult, StrResult};
@@ -293,7 +293,7 @@ impl Array {
vec.make_mut().sort_by(|a, b| {
a.partial_cmp(b).unwrap_or_else(|| {
if result.is_ok() {
- result = Err(format_eco!(
+ result = Err(eco_format!(
"cannot order {} and {}",
a.type_name(),
b.type_name(),
@@ -335,7 +335,7 @@ impl Array {
/// The out of bounds access error message.
#[cold]
fn out_of_bounds(index: i64, len: i64) -> EcoString {
- format_eco!("array index out of bounds (index: {}, len: {})", index, len)
+ eco_format!("array index out of bounds (index: {}, len: {})", index, len)
}
/// The error message when the array is empty.
@@ -389,7 +389,7 @@ impl FromIterator<Value> for Array {
impl IntoIterator for Array {
type Item = Value;
- type IntoIter = ecow::IntoIter<Value>;
+ type IntoIter = ecow::vec::IntoIter<Value>;
fn into_iter(self) -> Self::IntoIter {
self.0.into_iter()
diff --git a/src/model/dict.rs b/src/model/dict.rs
index b6198b2c..50a2275f 100644
--- a/src/model/dict.rs
+++ b/src/model/dict.rs
@@ -3,7 +3,7 @@ use std::fmt::{self, Debug, Formatter, Write};
use std::ops::{Add, AddAssign};
use std::sync::Arc;
-use ecow::{format_eco, EcoString};
+use ecow::{eco_format, EcoString};
use super::{array, Array, Str, Value};
use crate::diag::StrResult;
@@ -66,7 +66,7 @@ impl Dict {
pub fn take(&mut self, key: &str) -> StrResult<Value> {
Arc::make_mut(&mut self.0)
.remove(key)
- .ok_or_else(|| format_eco!("missing key: {:?}", Str::from(key)))
+ .ok_or_else(|| eco_format!("missing key: {:?}", Str::from(key)))
}
/// Whether the dictionary contains a specific key.
@@ -123,7 +123,7 @@ impl Dict {
/// Return an "unexpected key" error if there is any remaining pair.
pub fn finish(&self, expected: &[&str]) -> StrResult<()> {
if let Some((key, _)) = self.iter().next() {
- let parts: Vec<_> = expected.iter().map(|s| format_eco!("\"{s}\"")).collect();
+ let parts: Vec<_> = expected.iter().map(|s| eco_format!("\"{s}\"")).collect();
let mut msg = format!("unexpected key {key:?}, valid keys are ");
crate::diag::comma_list(&mut msg, &parts, "and");
return Err(msg.into());
@@ -135,7 +135,7 @@ impl Dict {
/// The missing key access error message.
#[cold]
fn missing_key(key: &str) -> EcoString {
- format_eco!("dictionary does not contain key {:?}", Str::from(key))
+ eco_format!("dictionary does not contain key {:?}", Str::from(key))
}
impl Debug for Dict {
diff --git a/src/model/module.rs b/src/model/module.rs
index 97c060e3..e911d859 100644
--- a/src/model/module.rs
+++ b/src/model/module.rs
@@ -1,7 +1,7 @@
use std::fmt::{self, Debug, Formatter};
use std::sync::Arc;
-use ecow::{format_eco, EcoString};
+use ecow::{eco_format, EcoString};
use super::{Content, Scope, Value};
use crate::diag::StrResult;
@@ -61,7 +61,7 @@ impl Module {
/// Try to access a definition in the module.
pub fn get(&self, name: &str) -> StrResult<&Value> {
self.scope().get(&name).ok_or_else(|| {
- format_eco!("module `{}` does not contain `{name}`", self.name())
+ eco_format!("module `{}` does not contain `{name}`", self.name())
})
}
diff --git a/src/model/ops.rs b/src/model/ops.rs
index be7892f9..52b9b06a 100644
--- a/src/model/ops.rs
+++ b/src/model/ops.rs
@@ -2,7 +2,7 @@
use std::cmp::Ordering;
-use ecow::format_eco;
+use ecow::eco_format;
use super::{format_str, Regex, Value};
use crate::diag::StrResult;
@@ -12,7 +12,7 @@ use Value::*;
/// Bail with a type mismatch error.
macro_rules! mismatch {
($fmt:expr, $($value:expr),* $(,)?) => {
- return Err(format_eco!($fmt, $($value.type_name()),*))
+ return Err(eco_format!($fmt, $($value.type_name()),*))
};
}
@@ -117,7 +117,7 @@ pub fn add(lhs: Value, rhs: Value) -> StrResult<Value> {
(a.downcast::<GenAlign>(), b.downcast::<GenAlign>())
{
if a.axis() == b.axis() {
- return Err(format_eco!("cannot add two {:?} alignments", a.axis()));
+ return Err(eco_format!("cannot add two {:?} alignments", a.axis()));
}
return Ok(Value::dynamic(match a.axis() {
diff --git a/src/model/str.rs b/src/model/str.rs
index 3eee9506..5fcc1d05 100644
--- a/src/model/str.rs
+++ b/src/model/str.rs
@@ -15,14 +15,14 @@ use crate::geom::GenAlign;
#[doc(hidden)]
macro_rules! __format_str {
($($tts:tt)*) => {{
- $crate::model::Str::from($crate::model::format_eco!($($tts)*))
+ $crate::model::Str::from($crate::model::eco_format!($($tts)*))
}};
}
#[doc(inline)]
pub use crate::__format_str as format_str;
#[doc(hidden)]
-pub use ecow::format_eco;
+pub use ecow::eco_format;
/// An immutable reference counted string.
#[derive(Default, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
@@ -297,13 +297,13 @@ impl Str {
/// The out of bounds access error message.
#[cold]
fn out_of_bounds(index: i64, len: i64) -> EcoString {
- format_eco!("string index out of bounds (index: {}, len: {})", index, len)
+ eco_format!("string index out of bounds (index: {}, len: {})", index, len)
}
/// The char boundary access error message.
#[cold]
fn not_a_char_boundary(index: i64) -> EcoString {
- format_eco!("string index {} is not a character boundary", index)
+ eco_format!("string index {} is not a character boundary", index)
}
/// The error message when the string is empty.
@@ -449,7 +449,7 @@ pub struct Regex(regex::Regex);
impl Regex {
/// Create a new regular expression.
pub fn new(re: &str) -> StrResult<Self> {
- regex::Regex::new(re).map(Self).map_err(|err| format_eco!("{err}"))
+ regex::Regex::new(re).map(Self).map_err(|err| eco_format!("{err}"))
}
}
diff --git a/src/model/value.rs b/src/model/value.rs
index 5c0ab618..f6ab95de 100644
--- a/src/model/value.rs
+++ b/src/model/value.rs
@@ -4,7 +4,7 @@ use std::fmt::{self, Debug, Formatter};
use std::hash::{Hash, Hasher};
use std::sync::Arc;
-use ecow::{format_eco, EcoString};
+use ecow::{eco_format, EcoString};
use siphasher::sip128::{Hasher128, SipHasher};
use super::{
@@ -122,9 +122,9 @@ impl Value {
Self::Dict(dict) => dict.at(&field).cloned(),
Self::Content(content) => content
.field(&field)
- .ok_or_else(|| format_eco!("unknown field `{field}`")),
+ .ok_or_else(|| eco_format!("unknown field `{field}`")),
Self::Module(module) => module.get(&field).cloned(),
- v => Err(format_eco!("cannot access fields on type {}", v.type_name())),
+ v => Err(eco_format!("cannot access fields on type {}", v.type_name())),
}
}
@@ -146,8 +146,8 @@ impl Value {
pub fn display(self) -> Content {
match self {
Self::None => Content::empty(),
- Self::Int(v) => item!(text)(format_eco!("{}", v)),
- Self::Float(v) => item!(text)(format_eco!("{}", v)),
+ Self::Int(v) => item!(text)(eco_format!("{}", v)),
+ Self::Float(v) => item!(text)(eco_format!("{}", v)),
Self::Str(v) => item!(text)(v.into()),
Self::Symbol(v) => item!(text)(v.get().into()),
Self::Content(v) => v,
@@ -402,7 +402,7 @@ macro_rules! primitive {
match value {
Value::$variant(v) => Ok(v),
$(Value::$other$(($binding))? => Ok($out),)*
- v => Err(format_eco!(
+ v => Err(eco_format!(
"expected {}, found {}",
Self::TYPE_NAME,
v.type_name(),