refactor: migrate to icu_normalizer for Unicode normalization#7
Merged
Conversation
… icu_normalizer Replace the unicode-normalization crate with icu_normalizer (icu4x) for NFC/NFKC normalization. This consolidates all Unicode operations under the icu4x family, which is already used for case mapping via icu_casemap. The icu_normalizer API returns Cow<str>, allowing us to avoid allocation when text is already in the target canonical form. Both apply_canonical_form and apply_case_mapping now return Cow<str> instead of String. Also fix the no_std clippy pre-push hook to exclude example crates, matching the CI workflow configuration.
waywardmonkeys
approved these changes
Apr 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
unicode-normalizationcrate withicu_normalizer(icu4x) for NFC/NFKC normalization, consolidating all Unicode operations under the icu4x familyCow<str>fromapply_canonical_formandapply_case_mappingto avoid allocation when text is already normalizedDetails
The project already uses
icu_casemapfor case mapping. This change drops theunicode-normalizationdependency (and its transitivetinyvec) in favor oficu_normalizer, which shares the existing icu4x data tables.The
icu_normalizer::ComposingNormalizerAPI returnsCow<str>, enabling a zero-allocation fast path when text is already in NFC/NFKC form. Both helper functions now propagateCowinstead of unconditionally allocatingString.Test plan
leit_texttests pass (10/10)cargo test --all-featurespassescargo clippy --workspace --all-features --all-targetsclean