mendelsshop

@mendelsshop@hachyderm.io

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?

mendelsshop ,

@became_fish

You can use a let else.

let val = some_function();  
let Some(val) = val else {  
 return Err(...);  
}  
  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • test
  • worldmews
  • mews
  • All magazines