398be8c842
Simplify negative `Option::{is_some_and,is_none_or}` Closes #13436. Improved based on the existing lint `nonminimal_bool`, since there is already handling of similar methods `Option::{is_some,is_none}` and `Result::{is_ok,is_err}`, and there is a lot of reusable code. When `is_some_and` or `is_none_or` have a negation, we invert it into another method by removing the Not sign and inverting the expression in the closure. For the case where the closure block has statements, currently no simplification is implemented. (Should we do it?) ```rust // Currently will not simplify this _ = !opt.is_some_and(|x| { let complex_block = 100; x == complex_block }); ``` changelog: [`nonminimal_bool`]: Simplify negative `Option::{is_some_and,is_none_or}` |
||
---|---|---|
.. | ||
test_utils | ||
ui | ||
ui-cargo | ||
ui-internal | ||
ui-toml | ||
workspace_test | ||
check-fmt.rs | ||
clippy.toml | ||
compile-test.rs | ||
config-metadata.rs | ||
dogfood.rs | ||
headers.rs | ||
integration.rs | ||
lint_message_convention.rs | ||
missing-test-files.rs | ||
versioncheck.rs | ||
workspace.rs |