about summary refs log tree commit diff
path: root/tests/ui/patchable-function-entry/patchable-function-entry-attribute.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-12-30 16:37:36 +0000
committerbors <bors@rust-lang.org>2023-12-30 16:37:36 +0000
commitc6aeb28a7b42e1c19e4ecbe60422c3fac0ee2895 (patch)
treee0a64d1bd88d279f29b7c20bb39829368b7a113e /tests/ui/patchable-function-entry/patchable-function-entry-attribute.rs
parentb19b5f293edfeca3d03707c39e8289348ce1ba24 (diff)
parentc4a80f2e3e8375ff54826840e2e2a5c53a20e2ce (diff)
downloadrust-c6aeb28a7b42e1c19e4ecbe60422c3fac0ee2895.tar.gz
rust-c6aeb28a7b42e1c19e4ecbe60422c3fac0ee2895.zip
Auto merge of #11865 - yuxqiu:map_unwrap_or_default, r=Jarcho
feat: add `manual_is_variant_and` lint

changelog: add a new lint [`manual_is_variant_and`].
- Replace `option.map(f).unwrap_or_default()` and `result.map(f).unwrap_or_default()` with `option.is_some_and(f)` and `result.is_ok_and(f)` where `f` is a function or closure that returns `bool`.
- MSRV is set to 1.70.0 for this lint; when `is_some_and` and `is_ok_and` was stabilised

---

For example, for the following code:

```rust
let opt = Some(0);
opt.map(|x| x > 1).unwrap_or_default();
```

It suggests to instead write:

```rust
let opt = Some(0);
opt.is_some_and(|x| x > 1)
```
Diffstat (limited to 'tests/ui/patchable-function-entry/patchable-function-entry-attribute.rs')
0 files changed, 0 insertions, 0 deletions