libcollections: remove unnecessary to_string()
calls
This commit is contained in:
parent
976660f3f7
commit
98ae63753b
10 changed files with 36 additions and 36 deletions
|
@ -2660,7 +2660,7 @@ mod tests {
|
|||
s.insert(10);
|
||||
s.insert(50);
|
||||
s.insert(2);
|
||||
assert_eq!("{1, 2, 10, 50}".to_string(), s.to_string());
|
||||
assert_eq!("{1, 2, 10, 50}", s.to_string());
|
||||
}
|
||||
|
||||
fn rng() -> rand::IsaacRng {
|
||||
|
|
|
@ -580,7 +580,7 @@ mod test {
|
|||
|
||||
let set_str = format!("{}", set);
|
||||
|
||||
assert!(set_str == "{1, 2}".to_string());
|
||||
assert_eq!(format!("{}", empty), "{}".to_string());
|
||||
assert!(set_str == "{1, 2}");
|
||||
assert_eq!(format!("{}", empty), "{}");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1838,20 +1838,20 @@ mod tests {
|
|||
})
|
||||
)
|
||||
let empty: Vec<int> = vec![];
|
||||
test_show_vec!(empty, "[]".to_string());
|
||||
test_show_vec!(vec![1i], "[1]".to_string());
|
||||
test_show_vec!(vec![1i, 2, 3], "[1, 2, 3]".to_string());
|
||||
test_show_vec!(empty, "[]");
|
||||
test_show_vec!(vec![1i], "[1]");
|
||||
test_show_vec!(vec![1i, 2, 3], "[1, 2, 3]");
|
||||
test_show_vec!(vec![vec![], vec![1u], vec![1u, 1u]],
|
||||
"[[], [1], [1, 1]]".to_string());
|
||||
"[[], [1], [1, 1]]");
|
||||
|
||||
let empty_mut: &mut [int] = &mut[];
|
||||
test_show_vec!(empty_mut, "[]".to_string());
|
||||
test_show_vec!(empty_mut, "[]");
|
||||
let v: &mut[int] = &mut[1];
|
||||
test_show_vec!(v, "[1]".to_string());
|
||||
test_show_vec!(v, "[1]");
|
||||
let v: &mut[int] = &mut[1, 2, 3];
|
||||
test_show_vec!(v, "[1, 2, 3]".to_string());
|
||||
test_show_vec!(v, "[1, 2, 3]");
|
||||
let v: &mut [&mut[uint]] = &mut[&mut[], &mut[1u], &mut[1u, 1u]];
|
||||
test_show_vec!(v, "[[], [1], [1, 1]]".to_string());
|
||||
test_show_vec!(v, "[[], [1], [1, 1]]");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -1831,7 +1831,7 @@ mod tests {
|
|||
fn test_nfd_chars() {
|
||||
macro_rules! t {
|
||||
($input: expr, $expected: expr) => {
|
||||
assert_eq!($input.nfd_chars().collect::<String>(), $expected.into_string());
|
||||
assert_eq!($input.nfd_chars().collect::<String>(), $expected);
|
||||
}
|
||||
}
|
||||
t!("abc", "abc");
|
||||
|
@ -1850,7 +1850,7 @@ mod tests {
|
|||
fn test_nfkd_chars() {
|
||||
macro_rules! t {
|
||||
($input: expr, $expected: expr) => {
|
||||
assert_eq!($input.nfkd_chars().collect::<String>(), $expected.into_string());
|
||||
assert_eq!($input.nfkd_chars().collect::<String>(), $expected);
|
||||
}
|
||||
}
|
||||
t!("abc", "abc");
|
||||
|
@ -1869,7 +1869,7 @@ mod tests {
|
|||
fn test_nfc_chars() {
|
||||
macro_rules! t {
|
||||
($input: expr, $expected: expr) => {
|
||||
assert_eq!($input.nfc_chars().collect::<String>(), $expected.into_string());
|
||||
assert_eq!($input.nfc_chars().collect::<String>(), $expected);
|
||||
}
|
||||
}
|
||||
t!("abc", "abc");
|
||||
|
@ -1889,7 +1889,7 @@ mod tests {
|
|||
fn test_nfkc_chars() {
|
||||
macro_rules! t {
|
||||
($input: expr, $expected: expr) => {
|
||||
assert_eq!($input.nfkc_chars().collect::<String>(), $expected.into_string());
|
||||
assert_eq!($input.nfkc_chars().collect::<String>(), $expected);
|
||||
}
|
||||
}
|
||||
t!("abc", "abc");
|
||||
|
|
|
@ -1287,24 +1287,24 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn test_simple_types() {
|
||||
assert_eq!(1i.to_string(), "1".to_string());
|
||||
assert_eq!((-1i).to_string(), "-1".to_string());
|
||||
assert_eq!(200u.to_string(), "200".to_string());
|
||||
assert_eq!(2u8.to_string(), "2".to_string());
|
||||
assert_eq!(true.to_string(), "true".to_string());
|
||||
assert_eq!(false.to_string(), "false".to_string());
|
||||
assert_eq!(().to_string(), "()".to_string());
|
||||
assert_eq!(("hi".to_string()).to_string(), "hi".to_string());
|
||||
assert_eq!(1i.to_string(), "1");
|
||||
assert_eq!((-1i).to_string(), "-1");
|
||||
assert_eq!(200u.to_string(), "200");
|
||||
assert_eq!(2u8.to_string(), "2");
|
||||
assert_eq!(true.to_string(), "true");
|
||||
assert_eq!(false.to_string(), "false");
|
||||
assert_eq!(().to_string(), "()");
|
||||
assert_eq!(("hi".to_string()).to_string(), "hi");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_vectors() {
|
||||
let x: Vec<int> = vec![];
|
||||
assert_eq!(x.to_string(), "[]".to_string());
|
||||
assert_eq!((vec![1i]).to_string(), "[1]".to_string());
|
||||
assert_eq!((vec![1i, 2, 3]).to_string(), "[1, 2, 3]".to_string());
|
||||
assert_eq!(x.to_string(), "[]");
|
||||
assert_eq!((vec![1i]).to_string(), "[1]");
|
||||
assert_eq!((vec![1i, 2, 3]).to_string(), "[1, 2, 3]");
|
||||
assert!((vec![vec![], vec![1i], vec![1i, 1]]).to_string() ==
|
||||
"[[], [1], [1, 1]]".to_string());
|
||||
"[[], [1], [1, 1]]");
|
||||
}
|
||||
|
||||
#[bench]
|
||||
|
|
|
@ -1735,8 +1735,8 @@ mod test_treemap {
|
|||
|
||||
let map_str = format!("{}", map);
|
||||
|
||||
assert!(map_str == "{1: 2, 3: 4}".to_string());
|
||||
assert_eq!(format!("{}", empty), "{}".to_string());
|
||||
assert!(map_str == "{1: 2, 3: 4}");
|
||||
assert_eq!(format!("{}", empty), "{}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -979,7 +979,7 @@ mod test {
|
|||
|
||||
let set_str = format!("{}", set);
|
||||
|
||||
assert!(set_str == "{1, 2}".to_string());
|
||||
assert_eq!(format!("{}", empty), "{}".to_string());
|
||||
assert!(set_str == "{1, 2}");
|
||||
assert_eq!(format!("{}", empty), "{}");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1605,8 +1605,8 @@ mod test {
|
|||
|
||||
let map_str = format!("{}", map);
|
||||
|
||||
assert!(map_str == "{1: a, 2: b}".to_string());
|
||||
assert_eq!(format!("{}", empty), "{}".to_string());
|
||||
assert!(map_str == "{1: a, 2: b}");
|
||||
assert_eq!(format!("{}", empty), "{}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -696,8 +696,8 @@ mod test {
|
|||
|
||||
let set_str = format!("{}", set);
|
||||
|
||||
assert!(set_str == "{1, 2}".to_string());
|
||||
assert_eq!(format!("{}", empty), "{}".to_string());
|
||||
assert!(set_str == "{1, 2}");
|
||||
assert_eq!(format!("{}", empty), "{}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -871,7 +871,7 @@ mod test_map {
|
|||
|
||||
let map_str = map.to_string();
|
||||
assert!(map_str == "{1: 2, 3: 4}" || map_str == "{3: 4, 1: 2}");
|
||||
assert_eq!(format!("{}", empty), "{}".to_string());
|
||||
assert_eq!(format!("{}", empty), "{}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue