diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2014-09-09 07:39:11 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2014-09-09 12:07:14 -0700 |
| commit | 613ae0b4862f162b0aaacd8b5d0f4392f6261b86 (patch) | |
| tree | a15ed2fd864a591dd9d9f348285b39bbb248ac3c /src/libcoretest | |
| parent | a9d8f295e0dbbc607ec97339b050cbf9132d3612 (diff) | |
| parent | 947a1b923b01f24e8217e398a44cc1f02f641080 (diff) | |
| download | rust-613ae0b4862f162b0aaacd8b5d0f4392f6261b86.tar.gz rust-613ae0b4862f162b0aaacd8b5d0f4392f6261b86.zip | |
rollup merge of #17106 : treeman/test-warnings
Diffstat (limited to 'src/libcoretest')
| -rw-r--r-- | src/libcoretest/any.rs | 24 | ||||
| -rw-r--r-- | src/libcoretest/option.rs | 3 | ||||
| -rw-r--r-- | src/libcoretest/result.rs | 1 |
3 files changed, 16 insertions, 12 deletions
diff --git a/src/libcoretest/any.rs b/src/libcoretest/any.rs index fae4a26cd38..9656a6caba0 100644 --- a/src/libcoretest/any.rs +++ b/src/libcoretest/any.rs @@ -51,22 +51,22 @@ 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; @@ -74,7 +74,7 @@ fn any_as_mut() { 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; @@ -82,7 +82,7 @@ fn any_as_mut() { 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; @@ -90,22 +90,22 @@ fn any_as_mut() { 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) } @@ -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)); }); } diff --git a/src/libcoretest/option.rs b/src/libcoretest/option.rs index 2dad9fc3a22..6e5bf6e8f2d 100644 --- a/src/libcoretest/option.rs +++ b/src/libcoretest/option.rs @@ -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| { @@ -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}); @@ -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))); diff --git a/src/libcoretest/result.rs b/src/libcoretest/result.rs index 7c7e0a542cd..dbc393967d3 100644 --- a/src/libcoretest/result.rs +++ b/src/libcoretest/result.rs @@ -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![])); |
