From 26cce993f5613d3ba551006f6c58896573dd50d0 Mon Sep 17 00:00:00 2001 From: Andras Schmelczer Date: Thu, 19 Dec 2024 22:00:51 +0000 Subject: [PATCH] Fix clippy broken code --- .../reconcile/src/operation_transformation.rs | 1 + .../src/operation_transformation/operation.rs | 18 +++++------------- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/backend/reconcile/src/operation_transformation.rs b/backend/reconcile/src/operation_transformation.rs index 6cad9d62..63b5c3cf 100644 --- a/backend/reconcile/src/operation_transformation.rs +++ b/backend/reconcile/src/operation_transformation.rs @@ -145,6 +145,7 @@ mod test { ); } + #[ignore = "it's too slow"] #[test_matrix( [ "pride_and_prejudice.txt", "romeo_and_juliet.txt", diff --git a/backend/reconcile/src/operation_transformation/operation.rs b/backend/reconcile/src/operation_transformation/operation.rs index 3b1ed231..9a434eb7 100644 --- a/backend/reconcile/src/operation_transformation/operation.rs +++ b/backend/reconcile/src/operation_transformation/operation.rs @@ -97,10 +97,7 @@ where match self { Operation::Insert { text, .. } => builder.insert( self.start_index(), - &text - .iter() - .map(super::super::tokenizer::token::Token::original) - .collect::(), + &text.iter().map(Token::original).collect::(), ), Operation::Delete { #[cfg(debug_assertions)] @@ -140,16 +137,13 @@ where } /// Returns the range of indices of characters that the operation affects. - pub fn range(&self) -> Range { self.start_index()..self.end_index() - 1 } + pub fn range(&self) -> Range { self.start_index()..self.end_index() + 1 } /// Returns the number of affected characters. It is always greater than 0 /// because empty operations cannot be created. pub fn len(&self) -> usize { match self { - Operation::Insert { text, .. } => text - .iter() - .map(super::super::tokenizer::token::Token::get_original_length) - .sum(), + Operation::Insert { text, .. } => text.iter().map(Token::get_original_length).sum(), Operation::Delete { deleted_character_count, .. @@ -223,7 +217,7 @@ where let trimmed_length = previous_inserted_text .iter() .skip(offset_in_tokens) - .map(super::super::tokenizer::token::Token::get_original_length) + .map(Token::get_original_length) .sum::(); let trimmed_operation = Operation::create_insert(index, text[trimmed_length_in_tokens..].to_vec()); @@ -311,9 +305,7 @@ where write!( f, "", - text.iter() - .map(super::super::tokenizer::token::Token::original) - .collect::(), + text.iter().map(Token::original).collect::(), index ) }