From a93c17711c74b733b7dc714504b8870a250a5c80 Mon Sep 17 00:00:00 2001 From: Andras Schmelczer Date: Sun, 2 Mar 2025 14:24:22 +0000 Subject: [PATCH] Add debug --- backend/reconcile/src/diffs/myers.rs | 6 +++--- backend/reconcile/src/diffs/raw_operation.rs | 4 ++-- .../src/operation_transformation/merge_context.rs | 8 ++++---- backend/reconcile/src/tokenizer/token.rs | 6 +++--- backend/reconcile/src/utils/ordered_operation.rs | 2 +- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/backend/reconcile/src/diffs/myers.rs b/backend/reconcile/src/diffs/myers.rs index e2f44989..cce51d54 100644 --- a/backend/reconcile/src/diffs/myers.rs +++ b/backend/reconcile/src/diffs/myers.rs @@ -38,7 +38,7 @@ use crate::{ /// execution time permitted before it bails and falls back to an approximation. pub fn diff(old: &[Token], new: &[Token]) -> Vec> where - T: PartialEq + Clone, + T: PartialEq + Clone + std::fmt::Debug, { let max_d = (old.len() + new.len()).div_ceil(2) + 1; let mut vb = V::new(max_d); @@ -124,7 +124,7 @@ fn find_middle_snake( vb: &mut V, ) -> Option<(usize, usize)> where - T: PartialEq + Clone, + T: PartialEq + Clone + std::fmt::Debug, { let n = old_range.len(); let m = new_range.len(); @@ -230,7 +230,7 @@ fn conquer( vb: &mut V, result: &mut Vec>, ) where - T: PartialEq + Clone, + T: PartialEq + Clone + std::fmt::Debug, { // Check for common prefix let common_prefix_len = common_prefix_len(old, old_range.clone(), new, new_range.clone()); diff --git a/backend/reconcile/src/diffs/raw_operation.rs b/backend/reconcile/src/diffs/raw_operation.rs index 280460f6..bf970062 100644 --- a/backend/reconcile/src/diffs/raw_operation.rs +++ b/backend/reconcile/src/diffs/raw_operation.rs @@ -3,7 +3,7 @@ use crate::tokenizer::token::Token; #[derive(Debug, Clone, PartialEq)] pub enum RawOperation where - T: PartialEq + Clone, + T: PartialEq + Clone + std::fmt::Debug, { Insert(Vec>), Delete(Vec>), @@ -12,7 +12,7 @@ where impl RawOperation where - T: PartialEq + Clone, + T: PartialEq + Clone + std::fmt::Debug, { pub fn tokens(&self) -> &Vec> { match self { diff --git a/backend/reconcile/src/operation_transformation/merge_context.rs b/backend/reconcile/src/operation_transformation/merge_context.rs index 0bc3c34a..980389df 100644 --- a/backend/reconcile/src/operation_transformation/merge_context.rs +++ b/backend/reconcile/src/operation_transformation/merge_context.rs @@ -5,7 +5,7 @@ use crate::operation_transformation::Operation; #[derive(Clone)] pub struct MergeContext where - T: PartialEq + Clone, + T: PartialEq + Clone + std::fmt::Debug, { last_operation: Option>, pub shift: i64, @@ -13,7 +13,7 @@ where impl Default for MergeContext where - T: PartialEq + Clone, + T: PartialEq + Clone + std::fmt::Debug, { fn default() -> Self { MergeContext { @@ -25,7 +25,7 @@ where impl Debug for MergeContext where - T: PartialEq + Clone, + T: PartialEq + Clone + std::fmt::Debug, { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { f.debug_struct("MergeContext") @@ -37,7 +37,7 @@ where impl MergeContext where - T: PartialEq + Clone, + T: PartialEq + Clone + std::fmt::Debug, { pub fn last_operation(&self) -> Option<&Operation> { self.last_operation.as_ref() } diff --git a/backend/reconcile/src/tokenizer/token.rs b/backend/reconcile/src/tokenizer/token.rs index f723a2c2..b867bb20 100644 --- a/backend/reconcile/src/tokenizer/token.rs +++ b/backend/reconcile/src/tokenizer/token.rs @@ -8,7 +8,7 @@ use serde::{Deserialize, Serialize}; #[derive(Debug, Clone)] pub struct Token where - T: PartialEq + Clone, + T: PartialEq + Clone + std::fmt::Debug, { normalised: T, original: String, @@ -25,7 +25,7 @@ impl From<&str> for Token { impl Token where - T: PartialEq + Clone, + T: PartialEq + Clone + std::fmt::Debug, { pub fn new(normalised: T, original: String) -> Self { Token { @@ -43,7 +43,7 @@ where impl PartialEq for Token where - T: PartialEq + Clone, + T: PartialEq + Clone + std::fmt::Debug, { fn eq(&self, other: &Self) -> bool { self.normalised == other.normalised } } diff --git a/backend/reconcile/src/utils/ordered_operation.rs b/backend/reconcile/src/utils/ordered_operation.rs index 17229d2e..116b6372 100644 --- a/backend/reconcile/src/utils/ordered_operation.rs +++ b/backend/reconcile/src/utils/ordered_operation.rs @@ -7,7 +7,7 @@ use crate::operation_transformation::Operation; #[derive(Debug, Clone, PartialEq)] pub struct OrderedOperation where - T: PartialEq + Clone, + T: PartialEq + Clone + std::fmt::Debug, { pub order: usize, pub operation: Operation,