]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/src/docs/err_expect.txt
Auto merge of #104673 - matthiaskrgr:rollup-85f65ov, r=matthiaskrgr
[rust.git] / src / tools / clippy / src / docs / err_expect.txt
1 ### What it does
2 Checks for `.err().expect()` calls on the `Result` type.
3
4 ### Why is this bad?
5 `.expect_err()` can be called directly to avoid the extra type conversion from `err()`.
6
7 ### Example
8 ```
9 let x: Result<u32, &str> = Ok(10);
10 x.err().expect("Testing err().expect()");
11 ```
12 Use instead:
13 ```
14 let x: Result<u32, &str> = Ok(10);
15 x.expect_err("Testing expect_err");
16 ```