Skip to content

Commit d5fd489

Browse files
committed
Fixing test errors
1 parent 5511e83 commit d5fd489

File tree

3 files changed

+21
-10
lines changed

3 files changed

+21
-10
lines changed

crates/diff-engine/src/changes.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1022,7 +1022,7 @@ impl ChangeClassifier {
10221022

10231023
// Visibility changes
10241024
if src_sig.visibility != tgt_sig.visibility {
1025-
match (src_sig.visibility, tgt_sig.visibility) {
1025+
match (&src_sig.visibility, &tgt_sig.visibility) {
10261026
(smart_diff_semantic::Visibility::Public, _) => {
10271027
// Making public function less visible is breaking
10281028
is_breaking_change = true;
@@ -1121,16 +1121,16 @@ impl ChangeClassifier {
11211121

11221122
/// Update configuration
11231123
pub fn set_config(&mut self, config: ChangeClassificationConfig) {
1124-
self.config = config;
1125-
1126-
// Update tree edit distance configuration
1124+
// Update tree edit distance configuration before moving config
11271125
let tree_config = ZhangShashaConfig {
11281126
enable_caching: true,
11291127
enable_pruning: true,
11301128
max_depth: config.max_ast_depth,
11311129
..Default::default()
11321130
};
11331131
self.tree_edit_distance.set_config(tree_config);
1132+
1133+
self.config = config;
11341134
}
11351135

11361136
/// Enable or disable semantic analysis

crates/diff-engine/src/cross_file_tracker.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -934,13 +934,13 @@ impl CrossFileTracker {
934934

935935
/// Update configuration
936936
pub fn set_config(&mut self, config: CrossFileTrackerConfig) {
937-
self.config = config;
938-
939-
// Update Hungarian matcher config
937+
// Update Hungarian matcher config before moving config
940938
let mut hungarian_config = self.hungarian_matcher.get_config().clone();
941939
hungarian_config.cross_file_penalty = config.cross_file_move_penalty;
942940
hungarian_config.min_similarity_threshold = config.min_cross_file_similarity;
943941
self.hungarian_matcher.set_config(hungarian_config);
942+
943+
self.config = config;
944944
}
945945

946946
/// Clear caches

crates/diff-engine/src/refactoring.rs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -387,18 +387,29 @@ impl RefactoringDetector {
387387
}
388388

389389
// Enhanced pattern detection with AST and signature analysis
390-
let change_groups = self.group_related_changes(changes);
390+
let change_groups = {
391+
// Create a temporary scope to avoid borrow conflicts
392+
let groups = self.group_related_changes(changes);
393+
// Clone the groups to avoid lifetime issues
394+
groups.into_iter().map(|group| group.into_iter().cloned().collect::<Vec<_>>()).collect::<Vec<_>>()
395+
};
391396

392397
// Detect patterns with detailed analysis
393398
if self.config.enable_extract_method {
399+
let group_refs: Vec<Vec<&Change>> = change_groups.iter()
400+
.map(|group| group.iter().collect())
401+
.collect();
394402
patterns.extend(self.detect_extract_method_detailed(
395-
&change_groups, source_asts, target_asts, source_signatures, target_signatures
403+
&group_refs, source_asts, target_asts, source_signatures, target_signatures
396404
)?);
397405
}
398406

399407
if self.config.enable_inline_method {
408+
let group_refs: Vec<Vec<&Change>> = change_groups.iter()
409+
.map(|group| group.iter().collect())
410+
.collect();
400411
patterns.extend(self.detect_inline_method_detailed(
401-
&change_groups, source_asts, target_asts, source_signatures, target_signatures
412+
&group_refs, source_asts, target_asts, source_signatures, target_signatures
402413
)?);
403414
}
404415

0 commit comments

Comments
 (0)