diff options
| author | Alejandra González <blyxyas@gmail.com> | 2025-01-10 19:19:58 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-10 19:19:58 +0000 |
| commit | 579571d9cf95678048f2ad8527d039cc24683a0f (patch) | |
| tree | 1265dfeb7f45a858c9b58b600e7bb2cfd2dd6b08 /compiler/rustc_codegen_llvm/src/errors.rs | |
| parent | 8678f9cdb6b1f9f0182f51c2cabd44648eb8a9a5 (diff) | |
| parent | 4a69d0d4d8cb2b524f486d69d7c0a06eda68fd2b (diff) | |
| download | rust-579571d9cf95678048f2ad8527d039cc24683a0f.tar.gz rust-579571d9cf95678048f2ad8527d039cc24683a0f.zip | |
New lint: manual_ok_err (#13740)
changelog: [`manual_ok_err`]: new lint
Detect manual implementations of `.ok()` or `.err()`, as in
```rust
let a = match func() {
Ok(v) => Some(v),
Err(_) => None,
};
let b = if let Err(v) = func() {
Some(v)
} else {
None
};
```
which can be replaced by
```rust
let a = func().ok();
let b = func().err();
```
This pattern was detected in the wild in the Rust reimplementation of
coreutils:
https://github.com/uutils/coreutils/pull/6886#pullrequestreview-2465160137
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/errors.rs')
0 files changed, 0 insertions, 0 deletions
