Clean way to convert Result to Option in Rust
Hello colleagues! I've just started learning Rust and encountered a typical situation: I have a function returning `Result`, but for further work I need `Option`. For example, I'm reading an environment variable:
```rust
use std::env;
fn main() {
let port: Option = env::var("PORT") // Result
.and_then(|s| s.parse()) // Result
.ok(); // ???
}
```
I know that you can use `.ok()`, which converts `Result` to `Option`, discarding the error. But it seems to me not a very clean approach — we lose error information. Perhaps there is a more idiomatic way?
The second problem: I have a chain of calls with multiple `Result`s, and I want to convert them to `Opti