mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-24 05:33:27 +00:00
c6aeb28a7b
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) ``` |
||
---|---|---|
.. | ||
conf.rs | ||
lib.rs | ||
metadata.rs | ||
msrvs.rs | ||
types.rs |