From d01a403c65076f5ac34402c5201f75b95b95276f Mon Sep 17 00:00:00 2001 From: Peter Ammon Date: Tue, 17 Feb 2026 19:13:13 -0800 Subject: [PATCH] Cleanup ParserTestErrorBits harder We don't need this bitwise operator override. --- src/parse_constants.rs | 18 ------------------ src/parse_util.rs | 11 +++++++---- 2 files changed, 7 insertions(+), 22 deletions(-) diff --git a/src/parse_constants.rs b/src/parse_constants.rs index 838a01b81..407fe0983 100644 --- a/src/parse_constants.rs +++ b/src/parse_constants.rs @@ -2,7 +2,6 @@ use crate::prelude::*; use fish_fallback::{fish_wcswidth, fish_wcwidth}; -use std::ops::{BitOr, BitOrAssign}; pub type SourceOffset = u32; @@ -47,23 +46,6 @@ impl ParseIssue { }); } -// Allow | and |= to combine ParseIssues. -impl BitOr for ParseIssue { - type Output = Self; - fn bitor(self, rhs: Self) -> Self { - Self { - error: self.error | rhs.error, - incomplete: self.incomplete | rhs.incomplete, - } - } -} - -impl BitOrAssign for ParseIssue { - fn bitor_assign(&mut self, rhs: Self) { - *self = *self | rhs; - } -} - /// A range of source code. #[derive(PartialEq, Eq, Clone, Copy, Debug, Default)] pub struct SourceRange { diff --git a/src/parse_util.rs b/src/parse_util.rs index c1a437780..05a24fb9d 100644 --- a/src/parse_util.rs +++ b/src/parse_util.rs @@ -1228,7 +1228,8 @@ pub fn detect_parse_errors_in_ast( Kind::Argument(arg) => { let arg_src = arg.source(buff_src); if let Err(e) = detect_errors_in_argument(arg, arg_src, &mut out_errors) { - issue |= e; + issue.error |= e.error; + issue.incomplete |= e.incomplete; } } Kind::JobPipeline(job) => { @@ -1481,10 +1482,12 @@ pub fn detect_errors_in_argument( out_errors, ); let mut subst_errors = ParseErrorList::new(); - issue |= + if let Err(e) = detect_parse_errors(&arg_src[parens.command()], Some(&mut subst_errors), false) - .err() - .unwrap_or_default(); + { + issue.error |= e.error; + issue.incomplete |= e.incomplete; + } // Our command substitution produced error offsets relative to its source. Tweak the // offsets of the errors in the command substitution to account for both its offset