Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions gix-utils/src/str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ use std::{borrow::Cow, ffi::OsStr, path::Path};
///
/// At the expense of extra-compute, it does nothing if there is no work to be done, returning the original input without allocating.
pub fn precompose(s: Cow<'_, str>) -> Cow<'_, str> {
use unicode_normalization::UnicodeNormalization;
if s.as_ref().nfc().cmp(s.as_ref().chars()).is_eq() {
use unicode_normalization::{is_nfc, UnicodeNormalization};
if is_nfc(s.as_ref()) {
s
} else {
Cow::Owned(s.as_ref().nfc().collect())
Expand All @@ -16,8 +16,8 @@ pub fn precompose(s: Cow<'_, str>) -> Cow<'_, str> {
///
/// At the expense of extra-compute, it does nothing if there is no work to be done, returning the original input without allocating.
pub fn decompose(s: Cow<'_, str>) -> Cow<'_, str> {
use unicode_normalization::UnicodeNormalization;
if s.as_ref().nfd().cmp(s.as_ref().chars()).is_eq() {
use unicode_normalization::{is_nfd, UnicodeNormalization};
if is_nfd(s.as_ref()) {
s
} else {
Cow::Owned(s.as_ref().nfd().collect())
Expand Down
Loading