diff options
| author | bors <bors@rust-lang.org> | 2023-12-30 16:37:36 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-12-30 16:37:36 +0000 |
| commit | c6aeb28a7b42e1c19e4ecbe60422c3fac0ee2895 (patch) | |
| tree | e0a64d1bd88d279f29b7c20bb39829368b7a113e /clippy_lints/src/declared_lints.rs | |
| parent | b19b5f293edfeca3d03707c39e8289348ce1ba24 (diff) | |
| parent | c4a80f2e3e8375ff54826840e2e2a5c53a20e2ce (diff) | |
| download | rust-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 'clippy_lints/src/declared_lints.rs')
| -rw-r--r-- | clippy_lints/src/declared_lints.rs | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/clippy_lints/src/declared_lints.rs b/clippy_lints/src/declared_lints.rs index 9dd22135d95..5963c4c77d0 100644 --- a/clippy_lints/src/declared_lints.rs +++ b/clippy_lints/src/declared_lints.rs @@ -385,6 +385,7 @@ pub(crate) static LINTS: &[&crate::LintInfo] = &[ crate::methods::JOIN_ABSOLUTE_PATHS_INFO, crate::methods::MANUAL_FILTER_MAP_INFO, crate::methods::MANUAL_FIND_MAP_INFO, + crate::methods::MANUAL_IS_VARIANT_AND_INFO, crate::methods::MANUAL_NEXT_BACK_INFO, crate::methods::MANUAL_OK_OR_INFO, crate::methods::MANUAL_SATURATING_ARITHMETIC_INFO, |
