|
|
@ -13,7 +13,7 @@ mod tests {
|
|
|
|
let optional_target = Some(target);
|
|
|
|
let optional_target = Some(target);
|
|
|
|
|
|
|
|
|
|
|
|
// TODO: Make this an if let statement whose value is "Some" type
|
|
|
|
// TODO: Make this an if let statement whose value is "Some" type
|
|
|
|
if let Some(word) = optional_target {
|
|
|
|
word = optional_target {
|
|
|
|
assert_eq!(word, target);
|
|
|
|
assert_eq!(word, target);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -28,7 +28,7 @@ mod tests {
|
|
|
|
|
|
|
|
|
|
|
|
// TODO: make this a while let statement - remember that vector.pop also adds another layer of Option<T>
|
|
|
|
// TODO: make this a while let statement - remember that vector.pop also adds another layer of Option<T>
|
|
|
|
// You can stack `Option<T>`'s into while let and if let
|
|
|
|
// You can stack `Option<T>`'s into while let and if let
|
|
|
|
while let Some(Some(integer)) = optional_integers.pop() {
|
|
|
|
integer = optional_integers.pop() {
|
|
|
|
assert_eq!(integer, range);
|
|
|
|
assert_eq!(integer, range);
|
|
|
|
range -= 1;
|
|
|
|
range -= 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|