]> git.lizzy.rs Git - rust.git/commit - src/tools/rust-analyzer
Rollup merge of #91346 - ibraheemdev:result-inspect, r=dtolnay
authorMatthias Krüger <matthias.krueger@famsik.de>
Wed, 1 Dec 2021 09:50:22 +0000 (10:50 +0100)
committerGitHub <noreply@github.com>
Wed, 1 Dec 2021 09:50:22 +0000 (10:50 +0100)
commitce197e2bceca00372c172a02a966b96287476c55
treec9ea56c75b2c5ce11db09ba35d50ba517fc73c42
parentc09c16c0dff47b1ec143c266c3c06acdc84a4257
parent2e8358e1ab933c6599b40294c0b33a1a17d19a23
Rollup merge of #91346 - ibraheemdev:result-inspect, r=dtolnay

Add `Option::inspect` and `Result::{inspect, inspect_err}`

```rust
// core::result

impl Result<T, E> {
    pub fn inspect<F: FnOnce(&T)>(self, f: F) -> Self;
    pub fn inspect_err<F: FnOnce(&E)>(self, f: F) -> Self;
}

// core::option

impl Option<T> {
    pub fn inspect<F: FnOnce(&T)>(self, f: F) -> Self;
}
```