Skip to content

Commit 45263a7

Browse files
committed
feedback: simplify
1 parent 2909741 commit 45263a7

File tree

1 file changed

+6
-21
lines changed

1 file changed

+6
-21
lines changed

turbopack/crates/turbopack-core/src/module_graph/merged_modules.rs

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
use std::{cmp::Ordering, collections::hash_map::Entry};
22

33
use anyhow::{Context, Result, bail};
4-
use roaring::RoaringBitmap;
54
use rustc_hash::{FxHashMap, FxHashSet};
65
use tracing::Instrument;
76
use turbo_tasks::{
@@ -166,26 +165,12 @@ pub async fn compute_merged_modules(module_graph: Vc<ModuleGraph>) -> Result<Vc<
166165
let idx = next_index;
167166
next_index += 1;
168167

169-
match module_merged_groups.entry(module) {
170-
Entry::Occupied(mut entry) => {
171-
let current = entry.get_mut();
172-
if !current.contains(idx) {
173-
// Mark and continue traversal because modified
174-
current.insert(idx);
175-
GraphTraversalAction::Continue
176-
} else {
177-
// Unchanged, no need to forward to children
178-
GraphTraversalAction::Skip
179-
}
180-
}
181-
Entry::Vacant(entry) => {
182-
// First visit
183-
entry.insert(RoaringBitmapWrapper(
184-
RoaringBitmap::from_sorted_iter(std::iter::once(idx))
185-
.unwrap(),
186-
));
187-
GraphTraversalAction::Continue
188-
}
168+
if module_merged_groups.entry(module).or_default().insert(idx) {
169+
// Mark and continue traversal because modified (or first visit)
170+
GraphTraversalAction::Continue
171+
} else {
172+
// Unchanged, no need to forward to children
173+
GraphTraversalAction::Skip
189174
}
190175
} else {
191176
// Already visited and assigned a new group, no need to forward to

0 commit comments

Comments
 (0)