]> git.lizzy.rs Git - rust.git/commitdiff
Fallout from deprecation
authorAaron Turon <aturon@mozilla.com>
Fri, 21 Nov 2014 20:51:22 +0000 (12:51 -0800)
committerAaron Turon <aturon@mozilla.com>
Fri, 21 Nov 2014 22:10:13 +0000 (14:10 -0800)
src/libstd/ascii.rs
src/libstd/path/windows.rs
src/libterm/terminfo/parm.rs

index afac5db148fc0d70c446f51678875287d9c187ed..9a4814b4749bb3250a025819f94671ecc3c6b73c 100644 (file)
@@ -13,6 +13,7 @@
 //! Operations on ASCII strings and characters
 
 #![unstable = "unsure about placement and naming"]
+#![allow(deprecated)]
 
 use core::kinds::Sized;
 use fmt;
@@ -36,6 +37,7 @@ pub fn as_byte(&self) -> u8 {
         self.chr
     }
 
+    /// Deprecated: use `as_byte` isntead.
     #[deprecated = "use as_byte"]
     pub fn to_byte(self) -> u8 {
         self.as_byte()
@@ -48,6 +50,12 @@ pub fn as_char(&self) -> char {
         self.chr as char
     }
 
+    /// Deprecated: use `as_char` isntead.
+    #[deprecated = "use as_char"]
+    pub fn to_char(self) -> char {
+        self.as_char()
+    }
+
     /// Convert to lowercase.
     #[inline]
     #[stable]
index f31ffdab17b61dfe35ca40a098d296026895bda2..9f81de72980ce0f3c549fff1eb947a18d515d996 100644 (file)
@@ -235,10 +235,10 @@ fn shares_volume(me: &Path, path: &str) -> bool {
             let repr = me.repr.as_slice();
             match me.prefix {
                 Some(DiskPrefix) => {
-                    repr.as_bytes()[0] == path.as_bytes()[0].to_ascii().to_uppercase().to_byte()
+                    repr.as_bytes()[0] == path.as_bytes()[0].to_ascii().to_uppercase().as_byte()
                 }
                 Some(VerbatimDiskPrefix) => {
-                    repr.as_bytes()[4] == path.as_bytes()[0].to_ascii().to_uppercase().to_byte()
+                    repr.as_bytes()[4] == path.as_bytes()[0].to_ascii().to_uppercase().as_byte()
                 }
                 _ => false
             }
@@ -673,14 +673,17 @@ fn equiv_prefix(&self, other: &Path) -> bool {
         match (self.prefix, other.prefix) {
             (Some(DiskPrefix), Some(VerbatimDiskPrefix)) => {
                 self.is_absolute() &&
-                    s_repr.as_bytes()[0].to_ascii().eq_ignore_case(o_repr.as_bytes()[4].to_ascii())
+                    s_repr.as_bytes()[0].to_ascii().to_lowercase() ==
+                        o_repr.as_bytes()[4].to_ascii().to_lowercase()
             }
             (Some(VerbatimDiskPrefix), Some(DiskPrefix)) => {
                 other.is_absolute() &&
-                    s_repr.as_bytes()[4].to_ascii().eq_ignore_case(o_repr.as_bytes()[0].to_ascii())
+                    s_repr.as_bytes()[4].to_ascii().to_lowercase() ==
+                        o_repr.as_bytes()[0].to_ascii().to_lowercase()
             }
             (Some(VerbatimDiskPrefix), Some(VerbatimDiskPrefix)) => {
-                s_repr.as_bytes()[4].to_ascii().eq_ignore_case(o_repr.as_bytes()[4].to_ascii())
+                s_repr.as_bytes()[4].to_ascii().to_lowercase() ==
+                    o_repr.as_bytes()[4].to_ascii().to_lowercase()
             }
             (Some(UNCPrefix(_,_)), Some(VerbatimUNCPrefix(_,_))) => {
                 s_repr.slice(2, self.prefix_len()) == o_repr.slice(8, other.prefix_len())
@@ -747,10 +750,7 @@ fn normalize__(s: &str, prefix: Option<PathPrefix>) -> Option<String> {
                                 let mut s = String::from_str(s.slice_to(len));
                                 unsafe {
                                     let v = s.as_mut_vec();
-                                    v[0] = (*v)[0]
-                                                     .to_ascii()
-                                                     .to_uppercase()
-                                                     .to_byte();
+                                    v[0] = (*v)[0].to_ascii().to_uppercase().as_byte();
                                 }
                                 if is_abs {
                                     // normalize C:/ to C:\
@@ -765,7 +765,7 @@ fn normalize__(s: &str, prefix: Option<PathPrefix>) -> Option<String> {
                                 let mut s = String::from_str(s.slice_to(len));
                                 unsafe {
                                     let v = s.as_mut_vec();
-                                    v[4] = (*v)[4].to_ascii().to_uppercase().to_byte();
+                                    v[4] = (*v)[4].to_ascii().to_uppercase().as_byte();
                                 }
                                 Some(s)
                             }
@@ -787,13 +787,13 @@ fn normalize__(s: &str, prefix: Option<PathPrefix>) -> Option<String> {
                         match prefix {
                             Some(DiskPrefix) => {
                                 s.push(prefix_.as_bytes()[0].to_ascii()
-                                                   .to_uppercase().to_char());
+                                                   .to_uppercase().as_char());
                                 s.push(':');
                             }
                             Some(VerbatimDiskPrefix) => {
                                 s.push_str(prefix_.slice_to(4));
                                 s.push(prefix_.as_bytes()[4].to_ascii()
-                                                   .to_uppercase().to_char());
+                                                   .to_uppercase().as_char());
                                 s.push_str(prefix_.slice_from(5));
                             }
                             Some(UNCPrefix(a,b)) => {
index f910bfc5bd446099ac6e2fc432c36f5c9ee6eb3c..0060789a7344fb0149206edf11db815863fd4d9c 100644 (file)
@@ -535,9 +535,8 @@ fn format(val: Param, op: FormatOp, flags: Flags) -> Result<Vec<u8> ,String> {
                 FormatHEX => {
                     s = s.as_slice()
                          .to_ascii()
-                         .to_uppercase()
-                         .into_bytes()
-                         .into_iter()
+                         .iter()
+                         .map(|b| b.to_uppercase().as_byte())
                          .collect();
                     if flags.alternate {
                         let s_ = replace(&mut s, vec!(b'0', b'X'));