Skip to content

Commit c5e0231

Browse files
committed
Fixing test errors
1 parent fa0ddc7 commit c5e0231

File tree

2 files changed

+26
-26
lines changed

2 files changed

+26
-26
lines changed

crates/diff-engine/src/changes.rs

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1124,6 +1124,22 @@ impl ChangeClassifier {
11241124
self.similarity_scorer = None;
11251125
}
11261126
}
1127+
1128+
/// Detect if a change represents a function split
1129+
pub fn detect_split(&self, source: &CodeElement, targets: &[CodeElement]) -> bool {
1130+
targets.len() > 1
1131+
&& targets
1132+
.iter()
1133+
.all(|t| t.name.contains(&source.name) || source.name.contains(&t.name))
1134+
}
1135+
1136+
/// Detect if changes represent a function merge
1137+
pub fn detect_merge(&self, sources: &[CodeElement], target: &CodeElement) -> bool {
1138+
sources.len() > 1
1139+
&& sources
1140+
.iter()
1141+
.all(|s| s.name.contains(&target.name) || target.name.contains(&s.name))
1142+
}
11271143
}
11281144

11291145
#[cfg(test)]
@@ -1456,20 +1472,3 @@ mod tests {
14561472
assert!(classifier.similarity_scorer.is_some());
14571473
}
14581474
}
1459-
1460-
/// Detect if a change represents a function split
1461-
pub fn detect_split(&self, source: &CodeElement, targets: &[CodeElement]) -> bool {
1462-
targets.len() > 1
1463-
&& targets
1464-
.iter()
1465-
.all(|t| t.name.contains(&source.name) || source.name.contains(&t.name))
1466-
}
1467-
1468-
/// Detect if changes represent a function merge
1469-
pub fn detect_merge(&self, sources: &[CodeElement], target: &CodeElement) -> bool {
1470-
sources.len() > 1
1471-
&& sources
1472-
.iter()
1473-
.all(|s| s.name.contains(&target.name) || target.name.contains(&s.name))
1474-
}
1475-
}

crates/diff-engine/src/tree_edit.rs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -283,15 +283,6 @@ impl TreeEditDistance {
283283
}
284284
}
285285

286-
impl Default for EditCost {
287-
fn default() -> Self {
288-
Self {
289-
insert: 1.0,
290-
delete: 1.0,
291-
update: 1.0,
292-
}
293-
}
294-
295286
/// Preprocess tree to extract information needed for Zhang-Shasha algorithm
296287
fn preprocess_tree(&self, tree: &ASTNode) -> TreeInfo {
297288
let node_count = self.count_nodes(tree);
@@ -581,6 +572,16 @@ impl Default for EditCost {
581572
}
582573
}
583574

575+
impl Default for EditCost {
576+
fn default() -> Self {
577+
Self {
578+
insert: 1.0,
579+
delete: 1.0,
580+
update: 1.0,
581+
}
582+
}
583+
}
584+
584585
#[cfg(test)]
585586
mod tests {
586587
use super::*;

0 commit comments

Comments
 (0)