Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove some test warnings. #17106

Merged
merged 1 commit into from
Sep 9, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/libarena/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,7 @@ mod tests {
use self::test::Bencher;
use super::{Arena, TypedArena};

#[allow(dead_code)]
struct Point {
x: int,
y: int,
Expand Down Expand Up @@ -564,6 +565,7 @@ mod tests {
})
}

#[allow(dead_code)]
struct Noncopy {
string: String,
array: Vec<int>,
Expand Down
12 changes: 10 additions & 2 deletions src/libcollections/slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -864,6 +864,7 @@ mod tests {
}

#[test]
#[allow(deprecated)]
fn test_tailn() {
let mut a = vec![11i, 12, 13];
let b: &[int] = &[11, 12, 13];
Expand All @@ -875,6 +876,7 @@ mod tests {

#[test]
#[should_fail]
#[allow(deprecated)]
fn test_tailn_empty() {
let a: Vec<int> = vec![];
a.tailn(2);
Expand Down Expand Up @@ -909,6 +911,7 @@ mod tests {

#[test]
#[should_fail]
#[allow(deprecated)]
fn test_initn_empty() {
let a: Vec<int> = vec![];
a.as_slice().initn(2);
Expand Down Expand Up @@ -1466,6 +1469,7 @@ mod tests {
}

#[test]
#[allow(deprecated)]
fn test_unshift() {
let mut x = vec![1i, 2, 3];
x.unshift(0);
Expand Down Expand Up @@ -2079,6 +2083,7 @@ mod tests {
}

#[test]
#[allow(deprecated)]
fn test_shift_ref() {
let mut x: &[int] = [1, 2, 3, 4, 5];
let h = x.shift_ref();
Expand All @@ -2092,6 +2097,7 @@ mod tests {
}

#[test]
#[allow(deprecated)]
fn test_pop_ref() {
let mut x: &[int] = [1, 2, 3, 4, 5];
let h = x.pop_ref();
Expand Down Expand Up @@ -2171,6 +2177,7 @@ mod tests {
}

#[test]
#[allow(deprecated)]
fn test_mut_shift_ref() {
let mut x: &mut [int] = [1, 2, 3, 4, 5];
let h = x.mut_shift_ref();
Expand All @@ -2184,6 +2191,7 @@ mod tests {
}

#[test]
#[allow(deprecated)]
fn test_mut_pop_ref() {
let mut x: &mut [int] = [1, 2, 3, 4, 5];
let h = x.mut_pop_ref();
Expand Down Expand Up @@ -2441,7 +2449,7 @@ mod bench {
b.iter(|| {
v.sort();
});
b.bytes = (v.len() * mem::size_of_val(v.get(0))) as u64;
b.bytes = (v.len() * mem::size_of_val(&v[0])) as u64;
}

type BigSortable = (u64,u64,u64,u64);
Expand Down Expand Up @@ -2485,6 +2493,6 @@ mod bench {
b.iter(|| {
v.sort();
});
b.bytes = (v.len() * mem::size_of_val(v.get(0))) as u64;
b.bytes = (v.len() * mem::size_of_val(&v[0])) as u64;
}
}
24 changes: 12 additions & 12 deletions src/libcoretest/any.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,61 +51,61 @@ fn any_owning() {
}

#[test]
fn any_as_ref() {
fn any_downcast_ref() {
let a = &5u as &Any;

match a.as_ref::<uint>() {
match a.downcast_ref::<uint>() {
Some(&5) => {}
x => fail!("Unexpected value {}", x)
}

match a.as_ref::<Test>() {
match a.downcast_ref::<Test>() {
None => {}
x => fail!("Unexpected value {}", x)
}
}

#[test]
fn any_as_mut() {
fn any_downcast_mut() {
let mut a = 5u;
let mut b = box 7u;

let a_r = &mut a as &mut Any;
let tmp: &mut uint = &mut *b;
let b_r = tmp as &mut Any;

match a_r.as_mut::<uint>() {
match a_r.downcast_mut::<uint>() {
Some(x) => {
assert_eq!(*x, 5u);
*x = 612;
}
x => fail!("Unexpected value {}", x)
}

match b_r.as_mut::<uint>() {
match b_r.downcast_mut::<uint>() {
Some(x) => {
assert_eq!(*x, 7u);
*x = 413;
}
x => fail!("Unexpected value {}", x)
}

match a_r.as_mut::<Test>() {
match a_r.downcast_mut::<Test>() {
None => (),
x => fail!("Unexpected value {}", x)
}

match b_r.as_mut::<Test>() {
match b_r.downcast_mut::<Test>() {
None => (),
x => fail!("Unexpected value {}", x)
}

match a_r.as_mut::<uint>() {
match a_r.downcast_mut::<uint>() {
Some(&612) => {}
x => fail!("Unexpected value {}", x)
}

match b_r.as_mut::<uint>() {
match b_r.downcast_mut::<uint>() {
Some(&413) => {}
x => fail!("Unexpected value {}", x)
}
Expand All @@ -121,11 +121,11 @@ fn any_fixed_vec() {


#[bench]
fn bench_as_ref(b: &mut Bencher) {
fn bench_downcast_ref(b: &mut Bencher) {
b.iter(|| {
let mut x = 0i;
let mut y = &mut x as &mut Any;
test::black_box(&mut y);
test::black_box(y.as_ref::<int>() == Some(&0));
test::black_box(y.downcast_ref::<int>() == Some(&0));
});
}
3 changes: 3 additions & 0 deletions src/libcoretest/option.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ fn test_or_else() {
}

#[test]
#[allow(deprecated)]
fn test_option_while_some() {
let mut i = 0i;
Some(10i).while_some(|j| {
Expand Down Expand Up @@ -184,6 +185,7 @@ fn test_unwrap_or_else() {
}

#[test]
#[allow(deprecated)]
fn test_filtered() {
let some_stuff = Some(42i);
let modified_stuff = some_stuff.filtered(|&x| {x < 10});
Expand Down Expand Up @@ -256,6 +258,7 @@ fn test_mutate() {
}

#[test]
#[allow(deprecated)]
fn test_collect() {
let v: Option<Vec<int>> = collect(range(0i, 0)
.map(|_| Some(0i)));
Expand Down
1 change: 1 addition & 0 deletions src/libcoretest/result.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ pub fn test_impl_map_err() {
}

#[test]
#[allow(deprecated)]
fn test_collect() {
let v: Result<Vec<int>, ()> = collect(range(0i, 0).map(|_| Ok::<int, ()>(0)));
assert!(v == Ok(vec![]));
Expand Down
1 change: 1 addition & 0 deletions src/libdebug/repr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,7 @@ pub fn repr_to_string<T>(t: &T) -> String {
}

#[cfg(test)]
#[allow(dead_code)]
struct P {a: int, b: f64}

#[test]
Expand Down
6 changes: 3 additions & 3 deletions src/libgraphviz/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -632,9 +632,9 @@ mod tests {
id_name(n)
}
fn node_label(&'a self, n: &Node) -> LabelText<'a> {
match self.node_labels.get(*n) {
&Some(ref l) => LabelStr(str::Slice(l.as_slice())),
&None => LabelStr(id_name(n).name()),
match self.node_labels[*n] {
Some(ref l) => LabelStr(str::Slice(l.as_slice())),
None => LabelStr(id_name(n).name()),
}
}
fn edge_label(&'a self, e: & &'a Edge) -> LabelText<'a> {
Expand Down
1 change: 1 addition & 0 deletions src/libgreen/sched.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1414,6 +1414,7 @@ mod test {
// Regression test that the `start` task entrypoint can
// contain dtors that use task resources
run(proc() {
#[allow(dead_code)]
struct S { field: () }

impl Drop for S {
Expand Down
84 changes: 42 additions & 42 deletions src/libnum/bigint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1978,10 +1978,10 @@ mod biguint_tests {
#[test]
fn test_checked_add() {
for elm in sum_triples.iter() {
let (aVec, bVec, cVec) = *elm;
let a = BigUint::from_slice(aVec);
let b = BigUint::from_slice(bVec);
let c = BigUint::from_slice(cVec);
let (a_vec, b_vec, c_vec) = *elm;
let a = BigUint::from_slice(a_vec);
let b = BigUint::from_slice(b_vec);
let c = BigUint::from_slice(c_vec);

assert!(a.checked_add(&b).unwrap() == c);
assert!(b.checked_add(&a).unwrap() == c);
Expand All @@ -1991,10 +1991,10 @@ mod biguint_tests {
#[test]
fn test_checked_sub() {
for elm in sum_triples.iter() {
let (aVec, bVec, cVec) = *elm;
let a = BigUint::from_slice(aVec);
let b = BigUint::from_slice(bVec);
let c = BigUint::from_slice(cVec);
let (a_vec, b_vec, c_vec) = *elm;
let a = BigUint::from_slice(a_vec);
let b = BigUint::from_slice(b_vec);
let c = BigUint::from_slice(c_vec);

assert!(c.checked_sub(&a).unwrap() == b);
assert!(c.checked_sub(&b).unwrap() == a);
Expand All @@ -2011,21 +2011,21 @@ mod biguint_tests {
#[test]
fn test_checked_mul() {
for elm in mul_triples.iter() {
let (aVec, bVec, cVec) = *elm;
let a = BigUint::from_slice(aVec);
let b = BigUint::from_slice(bVec);
let c = BigUint::from_slice(cVec);
let (a_vec, b_vec, c_vec) = *elm;
let a = BigUint::from_slice(a_vec);
let b = BigUint::from_slice(b_vec);
let c = BigUint::from_slice(c_vec);

assert!(a.checked_mul(&b).unwrap() == c);
assert!(b.checked_mul(&a).unwrap() == c);
}

for elm in div_rem_quadruples.iter() {
let (aVec, bVec, cVec, dVec) = *elm;
let a = BigUint::from_slice(aVec);
let b = BigUint::from_slice(bVec);
let c = BigUint::from_slice(cVec);
let d = BigUint::from_slice(dVec);
let (a_vec, b_vec, c_vec, d_vec) = *elm;
let a = BigUint::from_slice(a_vec);
let b = BigUint::from_slice(b_vec);
let c = BigUint::from_slice(c_vec);
let d = BigUint::from_slice(d_vec);

assert!(a == b.checked_mul(&c).unwrap() + d);
assert!(a == c.checked_mul(&b).unwrap() + d);
Expand All @@ -2035,10 +2035,10 @@ mod biguint_tests {
#[test]
fn test_checked_div() {
for elm in mul_triples.iter() {
let (aVec, bVec, cVec) = *elm;
let a = BigUint::from_slice(aVec);
let b = BigUint::from_slice(bVec);
let c = BigUint::from_slice(cVec);
let (a_vec, b_vec, c_vec) = *elm;
let a = BigUint::from_slice(a_vec);
let b = BigUint::from_slice(b_vec);
let c = BigUint::from_slice(c_vec);

if !a.is_zero() {
assert!(c.checked_div(&a).unwrap() == b);
Expand Down Expand Up @@ -2651,10 +2651,10 @@ mod bigint_tests {
#[test]
fn test_checked_add() {
for elm in sum_triples.iter() {
let (aVec, bVec, cVec) = *elm;
let a = BigInt::from_slice(Plus, aVec);
let b = BigInt::from_slice(Plus, bVec);
let c = BigInt::from_slice(Plus, cVec);
let (a_vec, b_vec, c_vec) = *elm;
let a = BigInt::from_slice(Plus, a_vec);
let b = BigInt::from_slice(Plus, b_vec);
let c = BigInt::from_slice(Plus, c_vec);

assert!(a.checked_add(&b).unwrap() == c);
assert!(b.checked_add(&a).unwrap() == c);
Expand All @@ -2670,10 +2670,10 @@ mod bigint_tests {
#[test]
fn test_checked_sub() {
for elm in sum_triples.iter() {
let (aVec, bVec, cVec) = *elm;
let a = BigInt::from_slice(Plus, aVec);
let b = BigInt::from_slice(Plus, bVec);
let c = BigInt::from_slice(Plus, cVec);
let (a_vec, b_vec, c_vec) = *elm;
let a = BigInt::from_slice(Plus, a_vec);
let b = BigInt::from_slice(Plus, b_vec);
let c = BigInt::from_slice(Plus, c_vec);

assert!(c.checked_sub(&a).unwrap() == b);
assert!(c.checked_sub(&b).unwrap() == a);
Expand All @@ -2689,10 +2689,10 @@ mod bigint_tests {
#[test]
fn test_checked_mul() {
for elm in mul_triples.iter() {
let (aVec, bVec, cVec) = *elm;
let a = BigInt::from_slice(Plus, aVec);
let b = BigInt::from_slice(Plus, bVec);
let c = BigInt::from_slice(Plus, cVec);
let (a_vec, b_vec, c_vec) = *elm;
let a = BigInt::from_slice(Plus, a_vec);
let b = BigInt::from_slice(Plus, b_vec);
let c = BigInt::from_slice(Plus, c_vec);

assert!(a.checked_mul(&b).unwrap() == c);
assert!(b.checked_mul(&a).unwrap() == c);
Expand All @@ -2702,11 +2702,11 @@ mod bigint_tests {
}

for elm in div_rem_quadruples.iter() {
let (aVec, bVec, cVec, dVec) = *elm;
let a = BigInt::from_slice(Plus, aVec);
let b = BigInt::from_slice(Plus, bVec);
let c = BigInt::from_slice(Plus, cVec);
let d = BigInt::from_slice(Plus, dVec);
let (a_vec, b_vec, c_vec, d_vec) = *elm;
let a = BigInt::from_slice(Plus, a_vec);
let b = BigInt::from_slice(Plus, b_vec);
let c = BigInt::from_slice(Plus, c_vec);
let d = BigInt::from_slice(Plus, d_vec);

assert!(a == b.checked_mul(&c).unwrap() + d);
assert!(a == c.checked_mul(&b).unwrap() + d);
Expand All @@ -2715,10 +2715,10 @@ mod bigint_tests {
#[test]
fn test_checked_div() {
for elm in mul_triples.iter() {
let (aVec, bVec, cVec) = *elm;
let a = BigInt::from_slice(Plus, aVec);
let b = BigInt::from_slice(Plus, bVec);
let c = BigInt::from_slice(Plus, cVec);
let (a_vec, b_vec, c_vec) = *elm;
let a = BigInt::from_slice(Plus, a_vec);
let b = BigInt::from_slice(Plus, b_vec);
let c = BigInt::from_slice(Plus, c_vec);

if !a.is_zero() {
assert!(c.checked_div(&a).unwrap() == b);
Expand Down
Loading