4 ms·
You can rewrite it using let-or-else to get rid of the unwrap, which some would find to be more idiomatic. let value = Some(param.as_ref()) else { //
by rav 1y ago
You can rewrite it using let-or-else to get rid of the unwrap, which some would find to be more idiomatic.
let value = Some(param.as_ref()) else {
// Handle, and continue, return an error etc
}
// Use `value` as normal.
- the__alchemist 1y agoThat part intrigued me about the article: I hadn't heard of that syntax! Will try.
- epidemian 1y agoSmall nit: the Some() pattern should go on the left side of the assignment: let Some(value) = param.as_ref() else { // Handle, and continue, return an error etc } // Use `value` as normal.