top | item 43976661 (no title) rav | 9 months 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. discuss order hn newest epidemian|9 months ago Small 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. the__alchemist|9 months ago That part intrigued me about the article: I hadn't heard of that syntax! Will try.
epidemian|9 months ago Small 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.
the__alchemist|9 months ago That part intrigued me about the article: I hadn't heard of that syntax! Will try.
epidemian|9 months ago
the__alchemist|9 months ago