Is it possible to do a "one liner" quick if
on a Result<Enum, Err>
where Enum
has multiple values but you only want to check one real quick?
Basically something like if !result.has_ok_value(Enum::SpecificCase) { ... }
I'm finding these cases quite cumbersome usually taking 4+ lines of code for no good reason and mostly I'm having trouble avoiding a "duplicate else".
E.g. I can do:
if let Some(enum) = &result.ok() {
if *enum != Enum::SomeValue {
do_the_stuff();
}
} else {
do_the_stuff();
}
Same with using match where I need to double-match and use do_the_stuff multiple times too.