Fix fallout
This commit is contained in:
parent
eac635de01
commit
09707d70a4
@ -945,7 +945,7 @@ mod tests {
|
||||
let mut m = list_from(v.as_slice());
|
||||
m.rotate_backward(); check_links(&m);
|
||||
m.rotate_forward(); check_links(&m);
|
||||
assert_eq!(v.iter().collect::<Vec<&int>>(), m.iter().collect());
|
||||
assert_eq!(v.iter().collect::<Vec<&int>>(), m.iter().collect::<Vec<_>>());
|
||||
m.rotate_forward(); check_links(&m);
|
||||
m.rotate_forward(); check_links(&m);
|
||||
m.pop_front(); check_links(&m);
|
||||
@ -953,7 +953,7 @@ mod tests {
|
||||
m.rotate_backward(); check_links(&m);
|
||||
m.push_front(9); check_links(&m);
|
||||
m.rotate_forward(); check_links(&m);
|
||||
assert_eq!(vec![3i,9,5,1,2], m.into_iter().collect());
|
||||
assert_eq!(vec![3i,9,5,1,2], m.into_iter().collect::<Vec<_>>());
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -397,23 +397,23 @@ mod test {
|
||||
fn test_iterator() {
|
||||
let mut e1: EnumSet<Foo> = EnumSet::new();
|
||||
|
||||
let elems: Vec<Foo> = e1.iter().collect();
|
||||
let elems: ::vec::Vec<Foo> = e1.iter().collect();
|
||||
assert!(elems.is_empty())
|
||||
|
||||
e1.insert(A);
|
||||
let elems = e1.iter().collect();
|
||||
let elems: ::vec::Vec<_> = e1.iter().collect();
|
||||
assert_eq!(vec![A], elems)
|
||||
|
||||
e1.insert(C);
|
||||
let elems = e1.iter().collect();
|
||||
let elems: ::vec::Vec<_> = e1.iter().collect();
|
||||
assert_eq!(vec![A,C], elems)
|
||||
|
||||
e1.insert(C);
|
||||
let elems = e1.iter().collect();
|
||||
let elems: ::vec::Vec<_> = e1.iter().collect();
|
||||
assert_eq!(vec![A,C], elems)
|
||||
|
||||
e1.insert(B);
|
||||
let elems = e1.iter().collect();
|
||||
let elems: ::vec::Vec<_> = e1.iter().collect();
|
||||
assert_eq!(vec![A,B,C], elems)
|
||||
}
|
||||
|
||||
@ -431,35 +431,35 @@ mod test {
|
||||
e2.insert(C);
|
||||
|
||||
let e_union = e1 | e2;
|
||||
let elems = e_union.iter().collect();
|
||||
let elems: ::vec::Vec<_> = e_union.iter().collect();
|
||||
assert_eq!(vec![A,B,C], elems)
|
||||
|
||||
let e_intersection = e1 & e2;
|
||||
let elems = e_intersection.iter().collect();
|
||||
let elems: ::vec::Vec<_> = e_intersection.iter().collect();
|
||||
assert_eq!(vec![C], elems)
|
||||
|
||||
// Another way to express intersection
|
||||
let e_intersection = e1 - (e1 - e2);
|
||||
let elems = e_intersection.iter().collect();
|
||||
let elems: ::vec::Vec<_> = e_intersection.iter().collect();
|
||||
assert_eq!(vec![C], elems)
|
||||
|
||||
let e_subtract = e1 - e2;
|
||||
let elems = e_subtract.iter().collect();
|
||||
let elems: ::vec::Vec<_> = e_subtract.iter().collect();
|
||||
assert_eq!(vec![A], elems)
|
||||
|
||||
// Bitwise XOR of two sets, aka symmetric difference
|
||||
let e_symmetric_diff = e1 ^ e2;
|
||||
let elems = e_symmetric_diff.iter().collect();
|
||||
let elems: ::vec::Vec<_> = e_symmetric_diff.iter().collect();
|
||||
assert_eq!(vec![A,B], elems)
|
||||
|
||||
// Another way to express symmetric difference
|
||||
let e_symmetric_diff = (e1 - e2) | (e2 - e1);
|
||||
let elems = e_symmetric_diff.iter().collect();
|
||||
let elems: ::vec::Vec<_> = e_symmetric_diff.iter().collect();
|
||||
assert_eq!(vec![A,B], elems)
|
||||
|
||||
// Yet another way to express symmetric difference
|
||||
let e_symmetric_diff = (e1 | e2) - (e1 & e2);
|
||||
let elems = e_symmetric_diff.iter().collect();
|
||||
let elems: ::vec::Vec<_> = e_symmetric_diff.iter().collect();
|
||||
assert_eq!(vec![A,B], elems)
|
||||
}
|
||||
|
||||
|
@ -1010,10 +1010,12 @@ mod tests {
|
||||
#[test]
|
||||
fn test_from_utf8_lossy() {
|
||||
let xs = b"hello";
|
||||
assert_eq!(String::from_utf8_lossy(xs), "hello".into_cow());
|
||||
let ys: str::CowString = "hello".into_cow();
|
||||
assert_eq!(String::from_utf8_lossy(xs), ys);
|
||||
|
||||
let xs = "ศไทย中华Việt Nam".as_bytes();
|
||||
assert_eq!(String::from_utf8_lossy(xs), "ศไทย中华Việt Nam".into_cow());
|
||||
let ys: str::CowString = "ศไทย中华Việt Nam".into_cow();
|
||||
assert_eq!(String::from_utf8_lossy(xs), ys);
|
||||
|
||||
let xs = b"Hello\xC2 There\xFF Goodbye";
|
||||
assert_eq!(String::from_utf8_lossy(xs),
|
||||
|
@ -1868,13 +1868,13 @@ mod tests {
|
||||
let mut values = vec![1u8,2,3,4,5];
|
||||
{
|
||||
let slice = values.slice_from_mut(2);
|
||||
assert!(slice == &mut [3, 4, 5]);
|
||||
assert!(slice == [3, 4, 5]);
|
||||
for p in slice.iter_mut() {
|
||||
*p += 2;
|
||||
}
|
||||
}
|
||||
|
||||
assert!(values.as_slice() == &[1, 2, 5, 6, 7]);
|
||||
assert!(values.as_slice() == [1, 2, 5, 6, 7]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -1882,13 +1882,13 @@ mod tests {
|
||||
let mut values = vec![1u8,2,3,4,5];
|
||||
{
|
||||
let slice = values.slice_to_mut(2);
|
||||
assert!(slice == &mut [1, 2]);
|
||||
assert!(slice == [1, 2]);
|
||||
for p in slice.iter_mut() {
|
||||
*p += 1;
|
||||
}
|
||||
}
|
||||
|
||||
assert!(values.as_slice() == &[2, 3, 3, 4, 5]);
|
||||
assert!(values.as_slice() == [2, 3, 3, 4, 5]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -226,7 +226,7 @@ extern "rust-intrinsic" {
|
||||
/// use std::mem;
|
||||
///
|
||||
/// let v: &[u8] = unsafe { mem::transmute("L") };
|
||||
/// assert!(v == &[76u8]);
|
||||
/// assert!(v == [76u8]);
|
||||
/// ```
|
||||
pub fn transmute<T,U>(e: T) -> U;
|
||||
|
||||
|
@ -274,9 +274,9 @@ impl<T> Option<T> {
|
||||
/// let mut x = Some("Diamonds");
|
||||
/// {
|
||||
/// let v = x.as_mut_slice();
|
||||
/// assert!(v == &mut ["Diamonds"]);
|
||||
/// assert!(v == ["Diamonds"]);
|
||||
/// v[0] = "Dirt";
|
||||
/// assert!(v == &mut ["Dirt"]);
|
||||
/// assert!(v == ["Dirt"]);
|
||||
/// }
|
||||
/// assert_eq!(x, Some("Dirt"));
|
||||
/// ```
|
||||
@ -554,7 +554,7 @@ impl<T> Option<T> {
|
||||
///
|
||||
/// let x = None;
|
||||
/// let v: Vec<&str> = x.into_iter().collect();
|
||||
/// assert_eq!(v, vec![]);
|
||||
/// assert!(v.is_empty());
|
||||
/// ```
|
||||
#[inline]
|
||||
#[unstable = "waiting for iterator conventions"]
|
||||
|
@ -407,14 +407,14 @@ impl<T, E> Result<T, E> {
|
||||
/// let mut x: Result<&str, uint> = Ok("Gold");
|
||||
/// {
|
||||
/// let v = x.as_mut_slice();
|
||||
/// assert!(v == &mut ["Gold"]);
|
||||
/// assert!(v == ["Gold"]);
|
||||
/// v[0] = "Silver";
|
||||
/// assert!(v == &mut ["Silver"]);
|
||||
/// assert!(v == ["Silver"]);
|
||||
/// }
|
||||
/// assert_eq!(x, Ok("Silver"));
|
||||
///
|
||||
/// let mut x: Result<&str, uint> = Err(45);
|
||||
/// assert!(x.as_mut_slice() == &mut []);
|
||||
/// assert!(x.as_mut_slice().is_empty());
|
||||
/// ```
|
||||
#[inline]
|
||||
#[unstable = "waiting for mut conventions"]
|
||||
|
@ -374,20 +374,20 @@ pub trait SlicePrelude<T> for Sized? {
|
||||
/// // scoped to restrict the lifetime of the borrows
|
||||
/// {
|
||||
/// let (left, right) = v.split_at_mut(0);
|
||||
/// assert!(left == &mut []);
|
||||
/// assert!(right == &mut [1i, 2, 3, 4, 5, 6]);
|
||||
/// assert!(left == []);
|
||||
/// assert!(right == [1i, 2, 3, 4, 5, 6]);
|
||||
/// }
|
||||
///
|
||||
/// {
|
||||
/// let (left, right) = v.split_at_mut(2);
|
||||
/// assert!(left == &mut [1i, 2]);
|
||||
/// assert!(right == &mut [3i, 4, 5, 6]);
|
||||
/// assert!(left == [1i, 2]);
|
||||
/// assert!(right == [3i, 4, 5, 6]);
|
||||
/// }
|
||||
///
|
||||
/// {
|
||||
/// let (left, right) = v.split_at_mut(6);
|
||||
/// assert!(left == &mut [1i, 2, 3, 4, 5, 6]);
|
||||
/// assert!(right == &mut []);
|
||||
/// assert!(left == [1i, 2, 3, 4, 5, 6]);
|
||||
/// assert!(right == []);
|
||||
/// }
|
||||
/// ```
|
||||
#[unstable = "waiting on final error conventions"]
|
||||
|
@ -109,7 +109,7 @@ fn test_transmute() {
|
||||
}
|
||||
|
||||
unsafe {
|
||||
assert!(vec![76u8] == transmute("L".to_string()));
|
||||
assert!(vec![76u8] == transmute::<_, Vec<u8>>("L".to_string()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,7 @@ fn replace_newline_with_backslash_l(s: String) -> String {
|
||||
let mut last_two: Vec<_> =
|
||||
s.as_slice().chars().rev().take(2).collect();
|
||||
last_two.reverse();
|
||||
if last_two.as_slice() != &['\\', 'l'] {
|
||||
if last_two != ['\\', 'l'] {
|
||||
s.push_str("\\l");
|
||||
}
|
||||
s
|
||||
|
@ -156,7 +156,7 @@ mod test {
|
||||
"rpath2".to_string(),
|
||||
"rpath1".to_string()
|
||||
]);
|
||||
assert!(res.as_slice() == &[
|
||||
assert!(res.as_slice() == [
|
||||
"rpath1".to_string(),
|
||||
"rpath2".to_string()
|
||||
]);
|
||||
@ -176,7 +176,7 @@ mod test {
|
||||
"4a".to_string(),
|
||||
"3".to_string()
|
||||
]);
|
||||
assert!(res.as_slice() == &[
|
||||
assert!(res.as_slice() == [
|
||||
"1a".to_string(),
|
||||
"2".to_string(),
|
||||
"4a".to_string(),
|
||||
|
@ -1545,7 +1545,7 @@ fn compile_unit_metadata(cx: &CrateContext) {
|
||||
Some(ref p) if p.is_relative() => {
|
||||
// prepend "./" if necessary
|
||||
let dotdot = b"..";
|
||||
let prefix = &[dotdot[0], ::std::path::SEP_BYTE];
|
||||
let prefix = [dotdot[0], ::std::path::SEP_BYTE];
|
||||
let mut path_bytes = p.as_vec().to_vec();
|
||||
|
||||
if path_bytes.slice_to(2) != prefix &&
|
||||
|
@ -172,7 +172,7 @@ pub fn main_args(args: &[String]) -> int {
|
||||
}
|
||||
}
|
||||
|
||||
if matches.opt_strs("passes").as_slice() == &["list".to_string()] {
|
||||
if matches.opt_strs("passes") == ["list"] {
|
||||
println!("Available passes for running rustdoc:");
|
||||
for &(name, _, description) in PASSES.iter() {
|
||||
println!("{:>20} - {}", name, description);
|
||||
|
@ -1528,7 +1528,7 @@ mod test {
|
||||
|
||||
check!(File::create(&tmpdir.join("test")).write(&bytes));
|
||||
let actual = check!(File::open(&tmpdir.join("test")).read_to_end());
|
||||
assert!(actual.as_slice() == &bytes);
|
||||
assert!(actual == bytes.as_slice());
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -2034,7 +2034,7 @@ mod tests {
|
||||
fn split_paths_windows() {
|
||||
fn check_parse(unparsed: &str, parsed: &[&str]) -> bool {
|
||||
split_paths(unparsed) ==
|
||||
parsed.iter().map(|s| Path::new(*s)).collect()
|
||||
parsed.iter().map(|s| Path::new(*s)).collect::<Vec<_>>()
|
||||
}
|
||||
|
||||
assert!(check_parse("", &mut [""]));
|
||||
@ -2054,7 +2054,7 @@ mod tests {
|
||||
fn split_paths_unix() {
|
||||
fn check_parse(unparsed: &str, parsed: &[&str]) -> bool {
|
||||
split_paths(unparsed) ==
|
||||
parsed.iter().map(|s| Path::new(*s)).collect()
|
||||
parsed.iter().map(|s| Path::new(*s)).collect::<Vec<_>>()
|
||||
}
|
||||
|
||||
assert!(check_parse("", &mut [""]));
|
||||
|
@ -224,10 +224,10 @@ mod test {
|
||||
assert_eq!(Vec::new(), v);
|
||||
|
||||
let v = SmallVector::one(1i);
|
||||
assert_eq!(vec!(1i), v.into_iter().collect());
|
||||
assert_eq!(vec!(1i), v.into_iter().collect::<Vec<_>>());
|
||||
|
||||
let v = SmallVector::many(vec!(1i, 2i, 3i));
|
||||
assert_eq!(vec!(1i, 2i, 3i), v.into_iter().collect());
|
||||
assert_eq!(vec!(1i, 2i, 3i), v.into_iter().collect::<Vec<_>>());
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -582,13 +582,13 @@ mod test {
|
||||
fn test_basic_setabf() {
|
||||
let s = b"\\E[48;5;%p1%dm";
|
||||
assert_eq!(expand(s, &[Number(1)], &mut Variables::new()).unwrap(),
|
||||
"\\E[48;5;1m".bytes().collect());
|
||||
"\\E[48;5;1m".bytes().collect::<Vec<_>>());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_multiple_int_constants() {
|
||||
assert_eq!(expand(b"%{1}%{2}%d%d", &[], &mut Variables::new()).unwrap(),
|
||||
"21".bytes().collect());
|
||||
"21".bytes().collect::<Vec<_>>());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -596,9 +596,9 @@ mod test {
|
||||
let mut vars = Variables::new();
|
||||
assert_eq!(expand(b"%p1%d%p2%d%p3%d%i%p1%d%p2%d%p3%d",
|
||||
&[Number(1),Number(2),Number(3)], &mut vars),
|
||||
Ok("123233".bytes().collect()));
|
||||
Ok("123233".bytes().collect::<Vec<_>>()));
|
||||
assert_eq!(expand(b"%p1%d%p2%d%i%p1%d%p2%d", &[], &mut vars),
|
||||
Ok("0011".bytes().collect()));
|
||||
Ok("0011".bytes().collect::<Vec<_>>()));
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -672,15 +672,15 @@ mod test {
|
||||
let res = expand(s, &[Number(1)], &mut vars);
|
||||
assert!(res.is_ok(), res.unwrap_err());
|
||||
assert_eq!(res.unwrap(),
|
||||
"\\E[31m".bytes().collect());
|
||||
"\\E[31m".bytes().collect::<Vec<_>>());
|
||||
let res = expand(s, &[Number(8)], &mut vars);
|
||||
assert!(res.is_ok(), res.unwrap_err());
|
||||
assert_eq!(res.unwrap(),
|
||||
"\\E[90m".bytes().collect());
|
||||
"\\E[90m".bytes().collect::<Vec<_>>());
|
||||
let res = expand(s, &[Number(42)], &mut vars);
|
||||
assert!(res.is_ok(), res.unwrap_err());
|
||||
assert_eq!(res.unwrap(),
|
||||
"\\E[38;5;42m".bytes().collect());
|
||||
"\\E[38;5;42m".bytes().collect::<Vec<_>>());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -692,13 +692,13 @@ mod test {
|
||||
Words("foo".to_string()),
|
||||
Words("f".to_string()),
|
||||
Words("foo".to_string())], vars),
|
||||
Ok("foofoo ffo".bytes().collect()));
|
||||
Ok("foofoo ffo".bytes().collect::<Vec<_>>()));
|
||||
assert_eq!(expand(b"%p1%:-4.2s", &[Words("foo".to_string())], vars),
|
||||
Ok("fo ".bytes().collect()));
|
||||
Ok("fo ".bytes().collect::<Vec<_>>()));
|
||||
|
||||
assert_eq!(expand(b"%p1%d%p1%.3d%p1%5d%p1%:+d", &[Number(1)], vars),
|
||||
Ok("1001 1+1".bytes().collect()));
|
||||
Ok("1001 1+1".bytes().collect::<Vec<_>>()));
|
||||
assert_eq!(expand(b"%p1%o%p1%#o%p2%6.4x%p2%#6.4X", &[Number(15), Number(27)], vars),
|
||||
Ok("17017 001b0X001B".bytes().collect()));
|
||||
Ok("17017 001b0X001B".bytes().collect::<Vec<_>>()));
|
||||
}
|
||||
}
|
||||
|
@ -26,5 +26,5 @@ fn main() {
|
||||
break
|
||||
}
|
||||
}
|
||||
assert!(result.as_slice() == &[2, 4]);
|
||||
assert!(result == [2, 4]);
|
||||
}
|
||||
|
@ -33,6 +33,6 @@ fn main() {
|
||||
let out = bar("baz", "foo");
|
||||
let [a, xs.., d] = out;
|
||||
assert_eq!(a, "baz");
|
||||
assert!(xs == &["foo", "foo"]);
|
||||
assert!(xs == ["foo", "foo"]);
|
||||
assert_eq!(d, "baz");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user