about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libcollections/str.rs4
-rw-r--r--src/librustc/metadata/encoder.rs2
-rw-r--r--src/libstd/ascii.rs24
-rw-r--r--src/libterm/terminfo/searcher.rs2
-rw-r--r--src/libtime/lib.rs6
5 files changed, 17 insertions, 21 deletions
diff --git a/src/libcollections/str.rs b/src/libcollections/str.rs
index 0b8535d1a34..2d01d138271 100644
--- a/src/libcollections/str.rs
+++ b/src/libcollections/str.rs
@@ -125,6 +125,7 @@ pub fn from_utf8_owned(vv: Vec<u8>) -> Result<String, Vec<u8>> {
 /// let string = str::from_byte(104);
 /// assert_eq!(string.as_slice(), "h");
 /// ```
+#[deprecated = "Replaced by String::from_byte"]
 pub fn from_byte(b: u8) -> String {
     assert!(b < 128u8);
     String::from_char(1, b as char)
@@ -139,8 +140,9 @@ pub fn from_byte(b: u8) -> String {
 /// let string = str::from_char('b');
 /// assert_eq!(string.as_slice(), "b");
 /// ```
+#[deprecated = "use String::from_char or char.to_string()"]
 pub fn from_char(ch: char) -> String {
-    String::from_char(ch)
+    String::from_char(1, ch)
 }
 
 /// Convert a vector of chars to a string
diff --git a/src/librustc/metadata/encoder.rs b/src/librustc/metadata/encoder.rs
index 3cf250a9517..85b5270e51b 100644
--- a/src/librustc/metadata/encoder.rs
+++ b/src/librustc/metadata/encoder.rs
@@ -619,7 +619,7 @@ fn encode_visibility(ebml_w: &mut Encoder, visibility: Visibility) {
         Public => 'y',
         Inherited => 'i',
     };
-    ebml_w.wr_str(str::from_char(ch).as_slice());
+    ebml_w.wr_str(ch.to_str().as_slice());
     ebml_w.end_tag();
 }
 
diff --git a/src/libstd/ascii.rs b/src/libstd/ascii.rs
index 93f026c76f9..23a7d45e928 100644
--- a/src/libstd/ascii.rs
+++ b/src/libstd/ascii.rs
@@ -525,7 +525,6 @@ static ASCII_UPPER_MAP: &'static [u8] = &[
 mod tests {
     use prelude::*;
     use super::*;
-    use str::from_char;
     use char::from_u32;
     use vec::Vec;
     use str::StrSlice;
@@ -677,8 +676,8 @@ mod tests {
         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_char(from_u32(i).unwrap()).as_slice().to_ascii_upper(),
-                       from_char(from_u32(upper).unwrap()).to_string())
+            assert_eq!((from_u32(i).unwrap()).to_str().as_slice().to_ascii_upper(),
+                       (from_u32(upper).unwrap()).to_str())
             i += 1;
         }
     }
@@ -693,8 +692,8 @@ mod tests {
         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_char(from_u32(i).unwrap()).as_slice().to_ascii_lower(),
-                       from_char(from_u32(lower).unwrap()).to_string())
+            assert_eq!((from_u32(i).unwrap()).to_str().as_slice().to_ascii_lower(),
+                       (from_u32(lower).unwrap()).to_str())
             i += 1;
         }
     }
@@ -709,8 +708,8 @@ mod tests {
         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_char(from_u32(i).unwrap()).to_string().into_ascii_upper(),
-                       from_char(from_u32(upper).unwrap()).to_string())
+            assert_eq!((from_u32(i).unwrap()).to_str().into_ascii_upper(),
+                       (from_u32(upper).unwrap()).to_str())
             i += 1;
         }
     }
@@ -726,8 +725,8 @@ mod tests {
         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_char(from_u32(i).unwrap()).to_string().into_ascii_lower(),
-                       from_char(from_u32(lower).unwrap()).to_string())
+            assert_eq!((from_u32(i).unwrap()).to_str().into_ascii_lower(),
+                       (from_u32(lower).unwrap()).to_str())
             i += 1;
         }
     }
@@ -747,11 +746,8 @@ mod tests {
             let c = i;
             let lower = if 'A' as u32 <= c && c <= 'Z' as u32 { c + 'a' as u32 - 'A' as u32 }
                         else { c };
-            assert!(from_char(from_u32(i).unwrap()).as_slice()
-                                                   .eq_ignore_ascii_case(
-                                                       from_char(
-                                                           from_u32(lower)
-                                                            .unwrap()).as_slice()));
+            assert!((from_u32(i).unwrap()).to_str().as_slice().eq_ignore_ascii_case(
+                    (from_u32(lower).unwrap()).to_str().as_slice()));
             i += 1;
         }
     }
diff --git a/src/libterm/terminfo/searcher.rs b/src/libterm/terminfo/searcher.rs
index 0002b20d205..dff67fc32db 100644
--- a/src/libterm/terminfo/searcher.rs
+++ b/src/libterm/terminfo/searcher.rs
@@ -59,7 +59,7 @@ pub fn get_dbpath_for_term(term: &str) -> Option<Box<Path>> {
     // Look for the terminal in all of the search directories
     for p in dirs_to_search.iter() {
         if p.exists() {
-            let f = str::from_char(first_char);
+            let f = first_char.to_str();
             let newp = p.join_many([f.as_slice(), term]);
             if newp.exists() {
                 return Some(box newp);
diff --git a/src/libtime/lib.rs b/src/libtime/lib.rs
index 4e20c073ac5..0690b561c44 100644
--- a/src/libtime/lib.rs
+++ b/src/libtime/lib.rs
@@ -486,9 +486,7 @@ pub fn strptime(s: &str, format: &str) -> Result<Tm, String> {
         if c == range.ch {
             Ok(range.next)
         } else {
-            Err(format!("Expected {}, found {}",
-                str::from_char(c),
-                str::from_char(range.ch)))
+            Err(format!("Expected {}, found {}", c, range.ch))
         }
     }
 
@@ -789,7 +787,7 @@ pub fn strptime(s: &str, format: &str) -> Result<Tm, String> {
           }
           '%' => parse_char(s, pos, '%'),
           ch => {
-            Err(format!("unknown formatting type: {}", str::from_char(ch)))
+            Err(format!("unknown formatting type: {}", ch))
           }
         }
     }