diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2015-03-05 18:23:57 -0800 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2015-03-10 15:08:31 -0700 |
| commit | 0f6a0b58f9dbc3a741abd898f2d06a8ba78a938d (patch) | |
| tree | 645a80f459c7da59405fc2dc8874a954b4aeb007 /src/libstd/old_io/process.rs | |
| parent | 2574009af0ff70dc233beab246db8f2d715be2cb (diff) | |
| download | rust-0f6a0b58f9dbc3a741abd898f2d06a8ba78a938d.tar.gz rust-0f6a0b58f9dbc3a741abd898f2d06a8ba78a938d.zip | |
std: Stabilize more of the `char` module
This commit performs another pass over the `std::char` module for stabilization.
Some minor cleanup is performed such as migrating documentation from libcore to
libunicode (where the `std`-facing trait resides) as well as a slight
reorganiation in libunicode itself. Otherwise, the stability modifications made
are:
* `char::from_digit` is now stable
* `CharExt::is_digit` is now stable
* `CharExt::to_digit` is now stable
* `CharExt::to_{lower,upper}case` are now stable after being modified to return
an iterator over characters. While the implementation today has not changed
this should allow us to implement the full set of case conversions in unicode
where some characters can map to multiple when doing an upper or lower case
mapping.
* `StrExt::to_{lower,upper}case` was added as unstable for a convenience of not
having to worry about characters expanding to more characters when you just
want the whole string to get into upper or lower case.
This is a breaking change due to the change in the signatures of the
`CharExt::to_{upper,lower}case` methods. Code can be updated to use functions
like `flat_map` or `collect` to handle the difference.
[breaking-change]
Diffstat (limited to 'src/libstd/old_io/process.rs')
| -rw-r--r-- | src/libstd/old_io/process.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/libstd/old_io/process.rs b/src/libstd/old_io/process.rs index e02e863516a..a30dcd9d9f0 100644 --- a/src/libstd/old_io/process.rs +++ b/src/libstd/old_io/process.rs @@ -110,10 +110,11 @@ struct EnvKey(CString); #[cfg(windows)] impl hash::Hash for EnvKey { fn hash<H: hash::Hasher>(&self, state: &mut H) { + use ascii::AsciiExt; let &EnvKey(ref x) = self; match str::from_utf8(x.as_bytes()) { Ok(s) => for ch in s.chars() { - (ch as u8 as char).to_lowercase().hash(state); + ch.to_ascii_lowercase().hash(state); }, Err(..) => x.hash(state) } @@ -123,6 +124,7 @@ impl hash::Hash for EnvKey { #[cfg(windows)] impl PartialEq for EnvKey { fn eq(&self, other: &EnvKey) -> bool { + use ascii::AsciiExt; let &EnvKey(ref x) = self; let &EnvKey(ref y) = other; match (str::from_utf8(x.as_bytes()), str::from_utf8(y.as_bytes())) { @@ -131,7 +133,7 @@ impl PartialEq for EnvKey { return false } else { for (xch, ych) in xs.chars().zip(ys.chars()) { - if xch.to_lowercase() != ych.to_lowercase() { + if xch.to_ascii_lowercase() != ych.to_ascii_lowercase() { return false; } } |
