-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Description
Hello Rustlings Team,
First of all thank you for this project. It was really fun solving it so far. I got really stuck and scratching my head at this one and I decided to ask you for an improvement.
fn simple_option() {
let target = "rustlings";
let optional_target = Some(target);
// TODO: Make this an if let statement whose value is "Some" type
word = optional_target {
assert_eq!(word, target);
}
}
Looks like this excercise is trying to show how to use Option<T>
type in Rust. Currently, the exercise seems somewhat forced and does not effectively demonstrate the real-world use cases of the Option type.
We start with a "rustlings" string literal and wrap it in optional_target. Then the comment asks us to Make this an if let statement whose value is "Some" type
(which is a riddle by itself) providing us with some convoluted assertion. I am just learning Rust and have never seen this type before. If that task had some real-world scenario showing us why Option type is useful (for example safe parsing of data) that would really help.