summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/src/docs/err_expect.txt
blob: 1dc83c5ce0ee05ded2a906da263f6f2cdbedcfe2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
### What it does
Checks for `.err().expect()` calls on the `Result` type.

### Why is this bad?
`.expect_err()` can be called directly to avoid the extra type conversion from `err()`.

### Example
```
let x: Result<u32, &str> = Ok(10);
x.err().expect("Testing err().expect()");
```
Use instead:
```
let x: Result<u32, &str> = Ok(10);
x.expect_err("Testing expect_err");
```