From e576824b696b836543d0e61be92f542547ffdbfb Mon Sep 17 00:00:00 2001 From: Michael Walsh <48160144+MpdWalsh@users.noreply.github.com> Date: Wed, 3 Nov 2021 13:48:58 -0600 Subject: [PATCH] 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.) --- exercises/standard_library_types/iterators1.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/exercises/standard_library_types/iterators1.rs b/exercises/standard_library_types/iterators1.rs index 4606ad35..26b246a6 100644 --- a/exercises/standard_library_types/iterators1.rs +++ b/exercises/standard_library_types/iterators1.rs @@ -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 }