summaryrefslogtreecommitdiff
path: root/src/diag.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/diag.rs
parent6bafc6391061d4b589dea835705a08b25a4df9f8 (diff)
Switch `StrResult` to `EcoString`
Diffstat (limited to 'src/diag.rs')
-rw-r--r--src/diag.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/diag.rs b/src/diag.rs
index 58eebf8b..29e43b91 100644
--- a/src/diag.rs
+++ b/src/diag.rs
@@ -154,13 +154,13 @@ impl<T> Trace<T> for SourceResult<T> {
}
/// A result type with a string error message.
-pub type StrResult<T> = Result<T, String>;
+pub type StrResult<T> = Result<T, EcoString>;
/// Transform `expected X, found Y` into `expected X or A, found Y`.
-pub fn with_alternative(msg: String, alt: &str) -> String {
+pub fn with_alternative(msg: EcoString, alt: &str) -> EcoString {
let mut parts = msg.split(", found ");
if let (Some(a), Some(b)) = (parts.next(), parts.next()) {
- format!("{} or {}, found {}", a, alt, b)
+ format_eco!("{} or {}, found {}", a, alt, b)
} else {
msg
}