diff --git a/exercises/12_options/options2.rs b/exercises/12_options/options2.rs index 4d998e7d..67a3956f 100644 --- a/exercises/12_options/options2.rs +++ b/exercises/12_options/options2.rs @@ -3,8 +3,6 @@ // Execute `rustlings hint options2` or use the `hint` watch subcommand for a // hint. -// I AM NOT DONE - #[cfg(test)] mod tests { #[test] @@ -13,9 +11,9 @@ mod tests { let optional_target = Some(target); // TODO: Make this an if let statement whose value is "Some" type - word = optional_target { + let word = if let Some(target) = optional_target { assert_eq!(word, target); - } + }; } #[test] @@ -32,10 +30,10 @@ mod tests { // TODO: make this a while let statement - remember that vector.pop also // adds another layer of Option. You can stack `Option`s into // while let and if let. - integer = optional_integers.pop() { + integer = if let Some(cursor) = optional_integers.pop() { assert_eq!(integer, cursor); - cursor -= 1; - } + cursor -= 1 + }; assert_eq!(cursor, 0); }