@laund@hachyderm.io avatar

laund

@laund@hachyderm.io

cisn't
❤️Rust + Bevy

This profile is from a federated server and may be incomplete. For a complete list of posts, browse on the original instance.

became_fish , to random
@became_fish@jorts.horse avatar

is there a way out of this pattern in :

let val = some_function();  
if val.is_none() {  
 return Ok(...);  
}  
let val = val.unwrap();  

that doesn't involve a bunch of nested match statements?

laund ,
@laund@hachyderm.io avatar

@became_fish

i would use let-else

let OK(val) = some_function() else {
return Ok(...)
};

assert_ne!(val, None);

  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • test
  • worldmews
  • mews
  • All magazines