about summary refs log tree commit diff
path: root/src/libstd/ascii.rs
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2015-08-11 17:27:05 -0700
committerAlex Crichton <alex@alexcrichton.com>2015-08-12 14:55:17 -0700
commit8d90d3f36871a00023cc1f313f91e351c287ca15 (patch)
tree2d9b616a2468117aa3afe1f6b1f910ff3116776b /src/libstd/ascii.rs
parentd07d465cf60033e35eba16b9e431471d54c712f4 (diff)
downloadrust-8d90d3f36871a00023cc1f313f91e351c287ca15.tar.gz
rust-8d90d3f36871a00023cc1f313f91e351c287ca15.zip
Remove all unstable deprecated functionality
This commit removes all unstable and deprecated functions in the standard
library. A release was recently cut (1.3) which makes this a good time for some
spring cleaning of the deprecated functions.
Diffstat (limited to 'src/libstd/ascii.rs')
-rw-r--r--src/libstd/ascii.rs99
1 files changed, 14 insertions, 85 deletions
diff --git a/src/libstd/ascii.rs b/src/libstd/ascii.rs
index ded572e82ff..82b5f60d65c 100644
--- a/src/libstd/ascii.rs
+++ b/src/libstd/ascii.rs
@@ -17,24 +17,6 @@ use prelude::v1::*;
 use mem;
 use ops::Range;
 
-/// Extension methods for ASCII-subset only operations on owned strings
-#[unstable(feature = "owned_ascii_ext",
-           reason = "would prefer to do this in a more general way")]
-#[deprecated(since = "1.3.0",
-             reason = "hasn't yet proved essential to be in the standard library")]
-#[allow(deprecated)]
-pub trait OwnedAsciiExt {
-    /// Converts the string to ASCII upper case:
-    /// ASCII letters 'a' to 'z' are mapped to 'A' to 'Z',
-    /// but non-ASCII letters are unchanged.
-    fn into_ascii_uppercase(self) -> Self;
-
-    /// Converts the string to ASCII lower case:
-    /// ASCII letters 'A' to 'Z' are mapped to 'a' to 'z',
-    /// but non-ASCII letters are unchanged.
-    fn into_ascii_lowercase(self) -> Self;
-}
-
 /// Extension methods for ASCII-subset only operations on string slices.
 #[stable(feature = "rust1", since = "1.0.0")]
 pub trait AsciiExt {
@@ -169,15 +151,19 @@ impl AsciiExt for str {
     }
 
     #[inline]
-    #[allow(deprecated)]
     fn to_ascii_uppercase(&self) -> String {
-        self.to_string().into_ascii_uppercase()
+        let mut bytes = self.as_bytes().to_vec();
+        bytes.make_ascii_uppercase();
+        // make_ascii_uppercase() preserves the UTF-8 invariant.
+        unsafe { String::from_utf8_unchecked(bytes) }
     }
 
     #[inline]
-    #[allow(deprecated)]
     fn to_ascii_lowercase(&self) -> String {
-        self.to_string().into_ascii_lowercase()
+        let mut bytes = self.as_bytes().to_vec();
+        bytes.make_ascii_lowercase();
+        // make_ascii_uppercase() preserves the UTF-8 invariant.
+        unsafe { String::from_utf8_unchecked(bytes) }
     }
 
     #[inline]
@@ -196,21 +182,6 @@ impl AsciiExt for str {
     }
 }
 
-#[allow(deprecated)]
-impl OwnedAsciiExt for String {
-    #[inline]
-    fn into_ascii_uppercase(self) -> String {
-        // Vec<u8>::into_ascii_uppercase() preserves the UTF-8 invariant.
-        unsafe { String::from_utf8_unchecked(self.into_bytes().into_ascii_uppercase()) }
-    }
-
-    #[inline]
-    fn into_ascii_lowercase(self) -> String {
-        // Vec<u8>::into_ascii_lowercase() preserves the UTF-8 invariant.
-        unsafe { String::from_utf8_unchecked(self.into_bytes().into_ascii_lowercase()) }
-    }
-}
-
 #[stable(feature = "rust1", since = "1.0.0")]
 impl AsciiExt for [u8] {
     type Owned = Vec<u8>;
@@ -220,15 +191,17 @@ impl AsciiExt for [u8] {
     }
 
     #[inline]
-    #[allow(deprecated)]
     fn to_ascii_uppercase(&self) -> Vec<u8> {
-        self.to_vec().into_ascii_uppercase()
+        let mut me = self.to_vec();
+        me.make_ascii_uppercase();
+        return me
     }
 
     #[inline]
-    #[allow(deprecated)]
     fn to_ascii_lowercase(&self) -> Vec<u8> {
-        self.to_vec().into_ascii_lowercase()
+        let mut me = self.to_vec();
+        me.make_ascii_lowercase();
+        return me
     }
 
     #[inline]
@@ -252,21 +225,6 @@ impl AsciiExt for [u8] {
     }
 }
 
-#[allow(deprecated)]
-impl OwnedAsciiExt for Vec<u8> {
-    #[inline]
-    fn into_ascii_uppercase(mut self) -> Vec<u8> {
-        self.make_ascii_uppercase();
-        self
-    }
-
-    #[inline]
-    fn into_ascii_lowercase(mut self) -> Vec<u8> {
-        self.make_ascii_lowercase();
-        self
-    }
-}
-
 #[stable(feature = "rust1", since = "1.0.0")]
 impl AsciiExt for u8 {
     type Owned = u8;
@@ -523,35 +481,6 @@ mod tests {
     }
 
     #[test]
-    fn test_into_ascii_uppercase() {
-        assert_eq!(("url()URL()uRl()ürl".to_string()).into_ascii_uppercase(),
-                   "URL()URL()URL()üRL".to_string());
-        assert_eq!(("hıKß".to_string()).into_ascii_uppercase(), "HıKß");
-
-        for i in 0..501 {
-            let upper = if 'a' as u32 <= i && i <= 'z' as u32 { i + 'A' as u32 - 'a' as u32 }
-                        else { i };
-            assert_eq!((from_u32(i).unwrap()).to_string().into_ascii_uppercase(),
-                       (from_u32(upper).unwrap()).to_string());
-        }
-    }
-
-    #[test]
-    fn test_into_ascii_lowercase() {
-        assert_eq!(("url()URL()uRl()Ürl".to_string()).into_ascii_lowercase(),
-                   "url()url()url()Ürl");
-        // Dotted capital I, Kelvin sign, Sharp S.
-        assert_eq!(("HİKß".to_string()).into_ascii_lowercase(), "hİKß");
-
-        for i in 0..501 {
-            let lower = if 'A' as u32 <= i && i <= 'Z' as u32 { i + 'a' as u32 - 'A' as u32 }
-                        else { i };
-            assert_eq!((from_u32(i).unwrap()).to_string().into_ascii_lowercase(),
-                       (from_u32(lower).unwrap()).to_string());
-        }
-    }
-
-    #[test]
     fn test_make_ascii_lower_case() {
         macro_rules! test {
             ($from: expr, $to: expr) => {