I'd like to know what is the most idiomatic way of checking if a q: Option<String> that I have has the value of a particular string that I have in my_string: String. So the most straightforward solution is:
if q.is_some() && q.unwrap() == my_string
Another one I can think of:
if q.unwrap_or_default() == my_string
but this wouldn't work in the corner case of my_string being empty.
Another one:
match q {
Some(s) if s == my_string => {
...
},
_ => {},
}
but this is very verbose.
Is there something simpler, like some clever if let?