]> git.lizzy.rs Git - rust.git/commitdiff
Rename to_ascii_{lower,upper} to to_ascii_{lower,upper}case, per #14401
authorSimon Sapin <simon.sapin@exyr.org>
Fri, 5 Dec 2014 17:57:42 +0000 (09:57 -0800)
committerSimon Sapin <simon.sapin@exyr.org>
Wed, 24 Dec 2014 18:33:04 +0000 (19:33 +0100)
[breaking-change]

src/compiletest/errors.rs
src/librustc/lint/mod.rs
src/librustdoc/html/markdown.rs
src/libstd/ascii.rs
src/test/run-pass/issue-10683.rs

index b7df43aabdd2093b9b6462970cdb30bff074bdf6..16c6f7250306d96a82630b7bf9a839c1eaaa6180 100644 (file)
@@ -67,7 +67,7 @@ fn parse_expected(last_nonfollow_error: Option<uint>,
                   re: &Regex) -> Option<(WhichLine, ExpectedError)> {
     re.captures(line).and_then(|caps| {
         let adjusts = caps.name("adjusts").unwrap_or("").len();
-        let kind = caps.name("kind").unwrap_or("").to_ascii_lower();
+        let kind = caps.name("kind").unwrap_or("").to_ascii_lowercase();
         let msg = caps.name("msg").unwrap_or("").trim().to_string();
         let follow = caps.name("follow").unwrap_or("").len() > 0;
 
index 009a1d444dc137b1e5574fdb07d994e959f5346f..787e999eea9f1eac75f33a8d3ac85f5714ede8e8 100644 (file)
@@ -68,7 +68,7 @@ pub struct Lint {
 impl Lint {
     /// Get the lint's name, with ASCII letters converted to lowercase.
     pub fn name_lower(&self) -> String {
-        self.name.to_ascii_lower()
+        self.name.to_ascii_lowercase()
     }
 }
 
index f7984b8973cc6a0968cf6c2d84cc7a7ea4430190..af0bc65d3cf7f0af54934057e0461ff442b812fe 100644 (file)
@@ -235,7 +235,7 @@ pub fn render(w: &mut fmt::Formatter, s: &str, print_toc: bool) -> fmt::Result {
         };
 
         // Transform the contents of the header into a hyphenated string
-        let id = s.words().map(|s| s.to_ascii_lower())
+        let id = s.words().map(|s| s.to_ascii_lowercase())
             .collect::<Vec<String>>().connect("-");
 
         // This is a terrible hack working around how hoedown gives us rendered
index 6c213555ce496db187b746cd9aeac834efd726ee..e46747a30d773f7fb1a4934e0dfc6d8ffe0a1976 100644 (file)
@@ -409,12 +409,12 @@ pub trait OwnedAsciiExt {
     /// Convert 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_upper(self) -> Self;
+    fn into_ascii_uppercase(self) -> Self;
 
     /// Convert 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_lower(self) -> Self;
+    fn into_ascii_lowercase(self) -> Self;
 }
 
 /// Extension methods for ASCII-subset only operations on string slices
@@ -423,15 +423,15 @@ pub trait AsciiExt<T> for Sized? {
     /// Makes a copy of the string in ASCII upper case:
     /// ASCII letters 'a' to 'z' are mapped to 'A' to 'Z',
     /// but non-ASCII letters are unchanged.
-    fn to_ascii_upper(&self) -> T;
+    fn to_ascii_uppercase(&self) -> T;
 
     /// Makes a copy of the string in ASCII lower case:
     /// ASCII letters 'A' to 'Z' are mapped to 'a' to 'z',
     /// but non-ASCII letters are unchanged.
-    fn to_ascii_lower(&self) -> T;
+    fn to_ascii_lowercase(&self) -> T;
 
     /// Check that two strings are an ASCII case-insensitive match.
-    /// Same as `to_ascii_lower(a) == to_ascii_lower(b)`,
+    /// Same as `to_ascii_lowercase(a) == to_ascii_lower(b)`,
     /// but without allocating and copying temporary strings.
     fn eq_ignore_ascii_case(&self, other: &Self) -> bool;
 }
@@ -439,15 +439,15 @@ pub trait AsciiExt<T> for Sized? {
 #[experimental = "would prefer to do this in a more general way"]
 impl AsciiExt<String> for str {
     #[inline]
-    fn to_ascii_upper(&self) -> String {
-        // Vec<u8>::to_ascii_upper() preserves the UTF-8 invariant.
-        unsafe { String::from_utf8_unchecked(self.as_bytes().to_ascii_upper()) }
+    fn to_ascii_uppercase(&self) -> String {
+        // Vec<u8>::to_ascii_uppercase() preserves the UTF-8 invariant.
+        unsafe { String::from_utf8_unchecked(self.as_bytes().to_ascii_uppercase()) }
     }
 
     #[inline]
-    fn to_ascii_lower(&self) -> String {
-        // Vec<u8>::to_ascii_lower() preserves the UTF-8 invariant.
-        unsafe { String::from_utf8_unchecked(self.as_bytes().to_ascii_lower()) }
+    fn to_ascii_lowercase(&self) -> String {
+        // Vec<u8>::to_ascii_lowercase() preserves the UTF-8 invariant.
+        unsafe { String::from_utf8_unchecked(self.as_bytes().to_ascii_lowercase()) }
     }
 
     #[inline]
@@ -459,27 +459,27 @@ fn eq_ignore_ascii_case(&self, other: &str) -> bool {
 #[experimental = "would prefer to do this in a more general way"]
 impl OwnedAsciiExt for String {
     #[inline]
-    fn into_ascii_upper(self) -> String {
-        // Vec<u8>::into_ascii_upper() preserves the UTF-8 invariant.
-        unsafe { String::from_utf8_unchecked(self.into_bytes().into_ascii_upper()) }
+    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_lower(self) -> String {
-        // Vec<u8>::into_ascii_lower() preserves the UTF-8 invariant.
-        unsafe { String::from_utf8_unchecked(self.into_bytes().into_ascii_lower()) }
+    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()) }
     }
 }
 
 #[experimental = "would prefer to do this in a more general way"]
 impl AsciiExt<Vec<u8>> for [u8] {
     #[inline]
-    fn to_ascii_upper(&self) -> Vec<u8> {
+    fn to_ascii_uppercase(&self) -> Vec<u8> {
         self.iter().map(|&byte| ASCII_UPPER_MAP[byte as uint]).collect()
     }
 
     #[inline]
-    fn to_ascii_lower(&self) -> Vec<u8> {
+    fn to_ascii_lowercase(&self) -> Vec<u8> {
         self.iter().map(|&byte| ASCII_LOWER_MAP[byte as uint]).collect()
     }
 
@@ -497,7 +497,7 @@ fn eq_ignore_ascii_case(&self, other: &[u8]) -> bool {
 #[experimental = "would prefer to do this in a more general way"]
 impl OwnedAsciiExt for Vec<u8> {
     #[inline]
-    fn into_ascii_upper(mut self) -> Vec<u8> {
+    fn into_ascii_uppercase(mut self) -> Vec<u8> {
         for byte in self.iter_mut() {
             *byte = ASCII_UPPER_MAP[*byte as uint];
         }
@@ -505,7 +505,7 @@ fn into_ascii_upper(mut self) -> Vec<u8> {
     }
 
     #[inline]
-    fn into_ascii_lower(mut self) -> Vec<u8> {
+    fn into_ascii_lowercase(mut self) -> Vec<u8> {
         for byte in self.iter_mut() {
             *byte = ASCII_LOWER_MAP[*byte as uint];
         }
@@ -775,64 +775,64 @@ fn test_opt() {
     }
 
     #[test]
-    fn test_to_ascii_upper() {
-        assert_eq!("url()URL()uRl()ürl".to_ascii_upper(), "URL()URL()URL()üRL");
-        assert_eq!("hıKß".to_ascii_upper(), "HıKß");
+    fn test_to_ascii_uppercase() {
+        assert_eq!("url()URL()uRl()ürl".to_ascii_uppercase(), "URL()URL()URL()üRL");
+        assert_eq!("hıKß".to_ascii_uppercase(), "HıKß");
 
         let mut i = 0;
         while i <= 500 {
             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().to_ascii_upper(),
+            assert_eq!((from_u32(i).unwrap()).to_string().to_ascii_uppercase(),
                        (from_u32(upper).unwrap()).to_string());
             i += 1;
         }
     }
 
     #[test]
-    fn test_to_ascii_lower() {
-        assert_eq!("url()URL()uRl()Ürl".to_ascii_lower(), "url()url()url()Ürl");
+    fn test_to_ascii_lowercase() {
+        assert_eq!("url()URL()uRl()Ürl".to_ascii_lowercase(), "url()url()url()Ürl");
         // Dotted capital I, Kelvin sign, Sharp S.
-        assert_eq!("HİKß".to_ascii_lower(), "hİKß");
+        assert_eq!("HİKß".to_ascii_lowercase(), "hİKß");
 
         let mut i = 0;
         while i <= 500 {
             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().to_ascii_lower(),
+            assert_eq!((from_u32(i).unwrap()).to_string().to_ascii_lowercase(),
                        (from_u32(lower).unwrap()).to_string());
             i += 1;
         }
     }
 
     #[test]
-    fn test_into_ascii_upper() {
-        assert_eq!(("url()URL()uRl()ürl".to_string()).into_ascii_upper(),
+    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_upper(), "HıKß");
+        assert_eq!(("hıKß".to_string()).into_ascii_uppercase(), "HıKß");
 
         let mut i = 0;
         while i <= 500 {
             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_upper(),
+            assert_eq!((from_u32(i).unwrap()).to_string().into_ascii_uppercase(),
                        (from_u32(upper).unwrap()).to_string());
             i += 1;
         }
     }
 
     #[test]
-    fn test_into_ascii_lower() {
-        assert_eq!(("url()URL()uRl()Ürl".to_string()).into_ascii_lower(),
+    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_lower(), "hİKß");
+        assert_eq!(("HİKß".to_string()).into_ascii_lowercase(), "hİKß");
 
         let mut i = 0;
         while i <= 500 {
             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_lower(),
+            assert_eq!((from_u32(i).unwrap()).to_string().into_ascii_lowercase(),
                        (from_u32(lower).unwrap()).to_string());
             i += 1;
         }
index df4342bfeb57e4fcc35dafbc08fa7f395bc3af36..26ee65fa565e2bb3588ed261fcec0e35177e8026 100644 (file)
@@ -13,7 +13,7 @@
 static NAME: &'static str = "hello world";
 
 fn main() {
-    match NAME.to_ascii_lower().as_slice() {
+    match NAME.to_ascii_lowercase().as_slice() {
         "foo" => {}
         _ => {}
     }