Skip to content

Commit 7a03b28

Browse files
committed
fix: Fix panic in unicode-table-generator
Commit 15acb0e introduced a panic when running `./x run tools/unicode-table-generator`. Fix it by undoing one of the refactors.
1 parent ca77504 commit 7a03b28

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/tools/unicode-table-generator/src/raw_emitter.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -339,10 +339,13 @@ impl Canonicalized {
339339
// We'll probably always have some slack though so this loop will still
340340
// be needed.
341341
for &w in unique_words {
342-
unique_mapping.entry(w).or_insert_with(|| {
342+
if !unique_mapping.contains_key(&w) {
343+
assert_eq!(
344+
unique_mapping.insert(w, UniqueMapping::Canonical(canonical_words.len())),
345+
None
346+
);
343347
canonical_words.push(w);
344-
UniqueMapping::Canonical(canonical_words.len())
345-
});
348+
}
346349
}
347350
assert_eq!(canonicalized_words.len() + canonical_words.len(), unique_words.len());
348351
assert_eq!(unique_mapping.len(), unique_words.len());

0 commit comments

Comments
 (0)