From 07cc33e7aa72f7563b7f5ee0ff14d3353b1df7da Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Fri, 21 Apr 2023 19:44:30 +0200 Subject: [PATCH] parse_util: deduplicate append_syntax_error macro --- fish-rust/src/parse_util.rs | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/fish-rust/src/parse_util.rs b/fish-rust/src/parse_util.rs index 69efdee25..6bce77f88 100644 --- a/fish-rust/src/parse_util.rs +++ b/fish-rust/src/parse_util.rs @@ -1166,15 +1166,9 @@ macro_rules! append_syntax_error { $(, $arg:expr)* $(,)? ) => { { - if let Some(ref mut errors) = $errors { - let mut error = ParseError::default(); - error.source_start = $source_location; - error.source_length = $source_length; - error.code = ParseErrorCode::syntax; - error.text = wgettext_fmt!($fmt $(, $arg)*); - errors.push(error); - } - true + append_syntax_error_formatted!( + $errors, $source_location, $source_length, + wgettext_fmt!($fmt $(, $arg)*)) } } }