let mut y = Some(5i);
let mut y2 = 0;
for _x in x.iter() {
- y2 = y.take_unwrap();
+ y2 = y.take().unwrap();
}
assert_eq!(y2, 5);
assert!(y.is_none());
#[test] #[should_fail]
fn test_option_too_much_dance() {
let mut y = Some(marker::NoCopy);
- let _y2 = y.take_unwrap();
- let _y3 = y.take_unwrap();
+ let _y2 = y.take().unwrap();
+ let _y3 = y.take().unwrap();
}
#[test]
}
#[test]
+#[allow(deprecated)]
fn test_option_while_some() {
let mut i = 0i;
Some(10i).while_some(|j| {
}
#[test]
+#[allow(deprecated)]
fn test_filtered() {
let some_stuff = Some(42i);
let modified_stuff = some_stuff.filtered(|&x| {x < 10});
let mut x = Some(val);
{
- let mut it = x.mut_iter();
+ let mut it = x.iter_mut();
assert_eq!(it.size_hint(), (1, Some(1)));
}
#[test]
+#[allow(deprecated)]
fn test_collect() {
let v: Option<Vec<int>> = collect(range(0i, 0)
.map(|_| Some(0i)));
// test that it does not take more elements than it needs
let mut functions = [|| Some(()), || None, || fail!()];
- let v: Option<Vec<()>> = collect(functions.mut_iter().map(|f| (*f)()));
+ let v: Option<Vec<()>> = collect(functions.iter_mut().map(|f| (*f)()));
assert!(v == None);
}