From 731b604c249fdf55451e2dd46c52cf4b96e10129 Mon Sep 17 00:00:00 2001 From: LagoLunatic Date: Tue, 13 May 2025 16:03:00 -0400 Subject: [PATCH] Fix highlighting of signed vs unsigned arguments (#202) * Fix signed and unsigned arguments not being considered equal when highlighting * Remove unused Eq derive --- objdiff-core/src/diff/display.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/objdiff-core/src/diff/display.rs b/objdiff-core/src/diff/display.rs index 3ac315b..cc7a723 100644 --- a/objdiff-core/src/diff/display.rs +++ b/objdiff-core/src/diff/display.rs @@ -77,7 +77,7 @@ impl<'a> DiffTextSegment<'a> { const EOL_SEGMENT: DiffTextSegment<'static> = DiffTextSegment { text: DiffText::Eol, color: DiffTextColor::Normal, pad_to: 0 }; -#[derive(Debug, Default, Clone, PartialEq, Eq)] +#[derive(Debug, Default, Clone)] pub enum HighlightKind { #[default] None, @@ -288,6 +288,18 @@ pub fn display_row( Ok(()) } +impl PartialEq for HighlightKind { + fn eq(&self, other: &HighlightKind) -> bool { + match (self, other) { + (HighlightKind::Opcode(a), HighlightKind::Opcode(b)) => a == b, + (HighlightKind::Argument(a), HighlightKind::Argument(b)) => a.loose_eq(b), + (HighlightKind::Symbol(a), HighlightKind::Symbol(b)) => a == b, + (HighlightKind::Address(a), HighlightKind::Address(b)) => a == b, + _ => false, + } + } +} + impl PartialEq> for HighlightKind { fn eq(&self, other: &DiffText) -> bool { match (self, other) {