From 1052107d1befbeadc1e6c75ba58a40f1dd85aae0 Mon Sep 17 00:00:00 2001 From: LagoLunatic Date: Tue, 13 May 2025 15:25:05 -0400 Subject: [PATCH 1/2] Fix signed and unsigned arguments not being considered equal when highlighting --- 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..b577e06 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, Eq)] 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) { From 3ecc1ee950e74f1a923139ceceb8910e6b1bd737 Mon Sep 17 00:00:00 2001 From: LagoLunatic Date: Tue, 13 May 2025 15:38:18 -0400 Subject: [PATCH 2/2] Remove unused Eq derive --- objdiff-core/src/diff/display.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/objdiff-core/src/diff/display.rs b/objdiff-core/src/diff/display.rs index b577e06..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, Eq)] +#[derive(Debug, Default, Clone)] pub enum HighlightKind { #[default] None,