Deprecate str::from_char
Use `String::from_char` or `.to_str` instead [breaking-change]
This commit is contained in:
parent
20a6894830
commit
05baf9b10c
5 changed files with 17 additions and 21 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue