mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-27 23:20:39 +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) ``` |
||
---|---|---|
.. | ||
src | ||
Cargo.toml | ||
README.md |