mirror of
https://github.com/rust-lang/rustlings.git
synced 2025-01-09 20:03:24 +03:00
fix(iterators1.rs): corrected a 'mismatched types' error
The values in the vector are of type &str. But within the tests, the additional & is changing the test strings to type &&str resulting in error E0308 (mismatched types). error[E0308]: mismatched types --> exercises/standard_library_types/iterators1.rs:18:5 | 18 | assert_eq!(my_iterable_fav_fruits.next(), Some(&"banana")); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `str`, found `&str` | = note: expected enum `Option<&str>` found enum `Option<&&str>` = note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info) (I sure hope that comes out formatted correctly.)
This commit is contained in:
parent
d1ee2daf14
commit
e576824b69
|
@ -15,10 +15,10 @@ fn main () {
|
|||
|
||||
let mut my_iterable_fav_fruits = ???; // 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(&"avocado"));
|
||||
assert_eq!(my_iterable_fav_fruits.next(), Some("avocado"));
|
||||
assert_eq!(my_iterable_fav_fruits.next(), ???); // TODO: Step 2.1
|
||||
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 3
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue