about summary refs log tree commit diff
path: root/src/libstd/path
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-12-27 21:51:43 +0000
committerbors <bors@rust-lang.org>2014-12-27 21:51:43 +0000
commit070ab63807dc80fa6a6c5ee80531284761ab42de (patch)
tree52706298e8d708cccdea4ad1781d58ea26887db1 /src/libstd/path
parent0201334439393bed205c1148bed425b80aab8c22 (diff)
parent12e60719c4cd2f1f4f8790eb0452869c5816f7dd (diff)
downloadrust-070ab63807dc80fa6a6c5ee80531284761ab42de.tar.gz
rust-070ab63807dc80fa6a6c5ee80531284761ab42de.zip
auto merge of #19916 : SimonSapin/rust/ascii-reform, r=sfackler
Implements [RFC 486](https://github.com/rust-lang/rfcs/pull/486). Fixes #19908.

* Rename `to_ascii_{lower,upper}` to `to_ascii_{lower,upper}case`, per #14401
* Remove the `Ascii` type and associated traits: `AsciiCast`, `OwnedAsciiCast`, `AsciiStr`, `IntoBytes`, and `IntoString`.
* As a replacement, add `.is_ascii()` to `AsciiExt`, and implement `AsciiExt` for `u8` and `char`.

[breaking-change]
Diffstat (limited to 'src/libstd/path')
-rw-r--r--src/libstd/path/windows.rs28
1 files changed, 13 insertions, 15 deletions
diff --git a/src/libstd/path/windows.rs b/src/libstd/path/windows.rs
index 12da1752adf..ea381bc0577 100644
--- a/src/libstd/path/windows.rs
+++ b/src/libstd/path/windows.rs
@@ -14,7 +14,7 @@
 
 use self::PathPrefix::*;
 
-use ascii::AsciiCast;
+use ascii::AsciiExt;
 use c_str::{CString, ToCStr};
 use clone::Clone;
 use cmp::{PartialEq, Eq, PartialOrd, Ord, Ordering};
@@ -237,10 +237,10 @@ impl GenericPathUnsafe for Path {
             let repr = me.repr[];
             match me.prefix {
                 Some(DiskPrefix) => {
-                    repr.as_bytes()[0] == path.as_bytes()[0].to_ascii().to_uppercase().as_byte()
+                    repr.as_bytes()[0] == path.as_bytes()[0].to_ascii_uppercase()
                 }
                 Some(VerbatimDiskPrefix) => {
-                    repr.as_bytes()[4] == path.as_bytes()[0].to_ascii().to_uppercase().as_byte()
+                    repr.as_bytes()[4] == path.as_bytes()[0].to_ascii_uppercase()
                 }
                 _ => false
             }
@@ -673,17 +673,17 @@ impl Path {
         match (self.prefix, other.prefix) {
             (Some(DiskPrefix), Some(VerbatimDiskPrefix)) => {
                 self.is_absolute() &&
-                    s_repr.as_bytes()[0].to_ascii().to_lowercase() ==
-                        o_repr.as_bytes()[4].to_ascii().to_lowercase()
+                    s_repr.as_bytes()[0].to_ascii_lowercase() ==
+                        o_repr.as_bytes()[4].to_ascii_lowercase()
             }
             (Some(VerbatimDiskPrefix), Some(DiskPrefix)) => {
                 other.is_absolute() &&
-                    s_repr.as_bytes()[4].to_ascii().to_lowercase() ==
-                        o_repr.as_bytes()[0].to_ascii().to_lowercase()
+                    s_repr.as_bytes()[4].to_ascii_lowercase() ==
+                        o_repr.as_bytes()[0].to_ascii_lowercase()
             }
             (Some(VerbatimDiskPrefix), Some(VerbatimDiskPrefix)) => {
-                s_repr.as_bytes()[4].to_ascii().to_lowercase() ==
-                    o_repr.as_bytes()[4].to_ascii().to_lowercase()
+                s_repr.as_bytes()[4].to_ascii_lowercase() ==
+                    o_repr.as_bytes()[4].to_ascii_lowercase()
             }
             (Some(UNCPrefix(_,_)), Some(VerbatimUNCPrefix(_,_))) => {
                 s_repr[2..self.prefix_len()] == o_repr[8..other.prefix_len()]
@@ -750,7 +750,7 @@ impl Path {
                                 let mut s = String::from_str(s[0..len]);
                                 unsafe {
                                     let v = s.as_mut_vec();
-                                    v[0] = (*v)[0].to_ascii().to_uppercase().as_byte();
+                                    v[0] = (*v)[0].to_ascii_uppercase();
                                 }
                                 if is_abs {
                                     // normalize C:/ to C:\
@@ -765,7 +765,7 @@ impl Path {
                                 let mut s = String::from_str(s[0..len]);
                                 unsafe {
                                     let v = s.as_mut_vec();
-                                    v[4] = (*v)[4].to_ascii().to_uppercase().as_byte();
+                                    v[4] = (*v)[4].to_ascii_uppercase();
                                 }
                                 Some(s)
                             }
@@ -786,14 +786,12 @@ impl Path {
                         let mut s = String::with_capacity(n);
                         match prefix {
                             Some(DiskPrefix) => {
-                                s.push(prefix_.as_bytes()[0].to_ascii()
-                                                   .to_uppercase().as_char());
+                                s.push(prefix_.as_bytes()[0].to_ascii_uppercase() as char);
                                 s.push(':');
                             }
                             Some(VerbatimDiskPrefix) => {
                                 s.push_str(prefix_[0..4]);
-                                s.push(prefix_.as_bytes()[4].to_ascii()
-                                                   .to_uppercase().as_char());
+                                s.push(prefix_.as_bytes()[4].to_ascii_uppercase() as char);
                                 s.push_str(prefix_[5..]);
                             }
                             Some(UNCPrefix(a,b)) => {