summaryrefslogtreecommitdiff
path: root/src/model/array.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2022-11-27 00:49:02 +0100
committerLaurenz <laurmaedje@gmail.com>2022-11-27 01:00:57 +0100
commit7caf98fe42797eab59a39ef71071030c9790245a (patch)
treecadf45a53aad29f11bf30a164f646b5a73bb5f16 /src/model/array.rs
parent6bafc6391061d4b589dea835705a08b25a4df9f8 (diff)
Switch `StrResult` to `EcoString`
Diffstat (limited to 'src/model/array.rs')
-rw-r--r--src/model/array.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/model/array.rs b/src/model/array.rs
index 5a2f8672..06d1b588 100644
--- a/src/model/array.rs
+++ b/src/model/array.rs
@@ -6,7 +6,7 @@ use std::sync::Arc;
use super::{ops, Args, Func, Value, Vm};
use crate::diag::{At, SourceResult, StrResult};
use crate::syntax::Spanned;
-use crate::util::ArcExt;
+use crate::util::{format_eco, ArcExt, EcoString};
/// Create a new [`Array`] from values.
#[macro_export]
@@ -253,7 +253,7 @@ impl Array {
vec.sort_by(|a, b| {
a.partial_cmp(b).unwrap_or_else(|| {
if result.is_ok() {
- result = Err(format!(
+ result = Err(format_eco!(
"cannot order {} and {}",
a.type_name(),
b.type_name(),
@@ -294,13 +294,13 @@ impl Array {
/// The out of bounds access error message.
#[cold]
-fn out_of_bounds(index: i64, len: i64) -> String {
- format!("array index out of bounds (index: {}, len: {})", index, len)
+fn out_of_bounds(index: i64, len: i64) -> EcoString {
+ format_eco!("array index out of bounds (index: {}, len: {})", index, len)
}
/// The error message when the array is empty.
#[cold]
-fn array_is_empty() -> String {
+fn array_is_empty() -> EcoString {
"array is empty".into()
}