Skip to content

Commit 5b06136

Browse files
KSXGitHubclaude
andauthored
refactor: add if guard to par_cull_insignificant_data (#426)
Co-authored-by: Claude <noreply@anthropic.com>
1 parent 3b728c1 commit 5b06136

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

src/app/sub.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,7 @@ where
129129
let min_ratio: f32 = min_ratio.into();
130130
let (data_tree, deduplication_record) = {
131131
let mut data_tree = data_tree;
132-
if min_ratio > 0.0 {
133-
data_tree.par_cull_insignificant_data(min_ratio);
134-
}
132+
data_tree.par_cull_insignificant_data(min_ratio);
135133
if !no_sort {
136134
data_tree.par_sort_by(|left, right| left.size().cmp(&right.size()).reverse());
137135
}

src/data_tree/retain.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ where
4141
where
4242
Size: Into<u64>,
4343
{
44+
if min_ratio <= 0.0 || min_ratio.is_nan() {
45+
return;
46+
}
4447
let minimal = self.size().into() as f32 * min_ratio;
4548
self.par_retain(|descendant, _| descendant.size().into() as f32 >= minimal);
4649
}

0 commit comments

Comments
 (0)