Skip to content

remove unused static data for to_lowercase #107502

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
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
9 changes: 2 additions & 7 deletions library/alloc/src/str.rs
Original file line number Diff line number Diff line change
@@ -385,16 +385,11 @@ impl str {
map_uppercase_sigma(rest, i, &mut s)
} else {
match conversions::to_lower(c) {
[a, '\0', _] => s.push(a),
[a, b, '\0'] => {
[a, '\0'] => s.push(a),
[a, b] => {
s.push(a);
s.push(b);
}
[a, b, c] => {
s.push(a);
s.push(b);
s.push(c);
}
}
}
}
2 changes: 1 addition & 1 deletion library/core/src/char/methods.rs
Original file line number Diff line number Diff line change
@@ -1018,7 +1018,7 @@ impl char {
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
pub fn to_lowercase(self) -> ToLowercase {
ToLowercase(CaseMappingIter::new(conversions::to_lower(self)))
ToLowercase(CaseMappingIter::new_lower(conversions::to_lower(self)))
}

/// Returns an iterator that yields the uppercase mapping of this `char` as one or more
7 changes: 7 additions & 0 deletions library/core/src/char/mod.rs
Original file line number Diff line number Diff line change
@@ -489,6 +489,13 @@ impl CaseMappingIter {
CaseMappingIter::Three(chars[0], chars[1], chars[2])
}
}
fn new_lower(chars: [char; 2]) -> CaseMappingIter {
if chars[1] == '\0' {
CaseMappingIter::One(chars[0]) // Including if chars[0] == '\0'
} else {
CaseMappingIter::Two(chars[0], chars[1])
}
}
}

impl Iterator for CaseMappingIter {
1,711 changes: 857 additions & 854 deletions library/core/src/unicode/unicode_data.rs

Large diffs are not rendered by default.