diff options
| author | Laurenz <laurmaedje@gmail.com> | 2023-04-18 14:31:09 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2023-04-18 14:31:32 +0200 |
| commit | bce83d330f0efc0f8cdd6fb01d8244cb9f01ac27 (patch) | |
| tree | 9e5d7add02a59b64725e25f866eb223514716a8f /src/diag.rs | |
| parent | 4613739748bd3110a96a2883440d6e36448729a1 (diff) | |
Remove intermediate strings in error message
Diffstat (limited to 'src/diag.rs')
| -rw-r--r-- | src/diag.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/diag.rs b/src/diag.rs index c1a7c834..88141062 100644 --- a/src/diag.rs +++ b/src/diag.rs @@ -249,31 +249,31 @@ impl From<FileError> for EcoString { } /// Format a user-facing error message for an XML-like file format. -pub fn format_xml_like_error(format: &str, error: roxmltree::Error) -> String { +pub fn format_xml_like_error(format: &str, error: roxmltree::Error) -> EcoString { match error { roxmltree::Error::UnexpectedCloseTag { expected, actual, pos } => { - format!( + eco_format!( "failed to parse {format}: found closing tag '{actual}' \ instead of '{expected}' in line {}", pos.row ) } roxmltree::Error::UnknownEntityReference(entity, pos) => { - format!( + eco_format!( "failed to parse {format}: unknown entity '{entity}' in line {}", pos.row ) } roxmltree::Error::DuplicatedAttribute(attr, pos) => { - format!( + eco_format!( "failed to parse {format}: duplicate attribute '{attr}' in line {}", pos.row ) } roxmltree::Error::NoRootNode => { - format!("failed to parse {format}: missing root node") + eco_format!("failed to parse {format}: missing root node") } roxmltree::Error::SizeLimit => "file is too large".into(), - _ => format!("failed to parse {format}"), + _ => eco_format!("failed to parse {format}"), } } |
