mirror of
https://github.com/rust-lang/rustlings.git
synced 2026-01-06 10:49:19 +00:00
Fix iterator implementation in iterators1.rs
This commit is contained in:
parent
d6c5788761
commit
2c4dc73771
@ -9,18 +9,16 @@
|
|||||||
// Execute `rustlings hint iterators1` or use the `hint` watch subcommand for a
|
// Execute `rustlings hint iterators1` or use the `hint` watch subcommand for a
|
||||||
// hint.
|
// hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn main() {
|
fn main() {
|
||||||
let my_fav_fruits = vec!["banana", "custard apple", "avocado", "peach", "raspberry"];
|
let my_fav_fruits = vec!["banana", "custard apple", "avocado", "peach", "raspberry"];
|
||||||
|
|
||||||
let mut my_iterable_fav_fruits = ???; // TODO: Step 1
|
let mut my_iterable_fav_fruits = my_fav_fruits.iter(); // TODO: Step 1
|
||||||
|
|
||||||
assert_eq!(my_iterable_fav_fruits.next(), Some(&"banana"));
|
assert_eq!(my_iterable_fav_fruits.next(), Some(&"banana"));
|
||||||
assert_eq!(my_iterable_fav_fruits.next(), ???); // TODO: Step 2
|
assert_eq!(my_iterable_fav_fruits.next(), Some(&"custard apple")); // TODO: Step 2
|
||||||
assert_eq!(my_iterable_fav_fruits.next(), Some(&"avocado"));
|
assert_eq!(my_iterable_fav_fruits.next(), Some(&"avocado"));
|
||||||
assert_eq!(my_iterable_fav_fruits.next(), ???); // TODO: Step 3
|
assert_eq!(my_iterable_fav_fruits.next(), Some(&"peach")); // TODO: Step 3
|
||||||
assert_eq!(my_iterable_fav_fruits.next(), Some(&"raspberry"));
|
assert_eq!(my_iterable_fav_fruits.next(), Some(&"raspberry"));
|
||||||
assert_eq!(my_iterable_fav_fruits.next(), ???); // TODO: Step 4
|
assert_eq!(my_iterable_fav_fruits.next(), None); // TODO: Step 4
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user