Say more?
-
-
This Tweet is unavailable.
-
- 5 more replies
-
-
-
I used `Result` and `Option` as an example, but replace `Some` with "arbitrary tuple struct constructor"
End of conversation
New conversation -
-
-
`Ok(Some(expr?))`, but only because it does error conversion, and in a lot of cases, that's what you want. If I don't need the error conversion, then `http://expr.map (Some)`.
-
Ah good point, I hadn't really considered the case where you actually have to use `?` (or add `.map_err(Into::into)` which I've done in the past)
End of conversation
New conversation -
-
-
As someone relatively new to the language, `Ok(Some(expr?))` feels immediately understandable, whereas `http://expr.map (Some)` assumes much more familiarity
-
It also expresses more about the type of expr (most probably a Result) than the latter. It's immediately clear that you're testing for errors, and rewrapping it.
End of conversation
New conversation -
-
-
Am with Ok(Some(expr?)), as readability should be preferred as long as it compiles down to same code !
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
if it's long, I'd introduce a local variable. So: let result = expr? Ok(Some(result))
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.