Files
rust/clippy_utils/src
Alejandra González 579571d9cf 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
2025-01-10 19:19:58 +00:00
..
2025-01-10 18:26:01 +01:00
2024-12-12 16:43:36 +00:00
2025-01-01 22:19:16 +01:00
2024-12-22 06:12:45 -08:00
2024-12-12 16:43:36 +00:00