diff options
| author | Samuel Tardieu <sam@rfc1149.net> | 2025-08-08 21:56:02 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-08-08 21:56:02 +0000 |
| commit | 388d3f3374265314b6f93c629281fb59ed485894 (patch) | |
| tree | c1331c361d6f2f83138ff9ff2cca6ef7ead49690 | |
| parent | 22088843b40d71296e3cf917537a6f8e47926735 (diff) | |
| parent | 82c1ce77ed1e3f7a90c00082ca7f365bd22a9c22 (diff) | |
| download | rust-388d3f3374265314b6f93c629281fb59ed485894.tar.gz rust-388d3f3374265314b6f93c629281fb59ed485894.zip | |
use a let-chain in `needless_bool` (#15444)
This is a small thing I noticed while looking into https://github.com/rust-lang/rust-clippy/issues/8014. Since I ultimately decided not to change the code as a response to the issue, I'm now left with this one commit, and I feel a bit unsure about making a PR just for that. This is a problem I have relatively often, so I'd like to know whether I should to batch these small changes somehow, or whether these small PRs are fine after all changelog: none
| -rw-r--r-- | clippy_lints/src/needless_bool.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/clippy_lints/src/needless_bool.rs b/clippy_lints/src/needless_bool.rs index fa5afcc0087..6ae26156bc4 100644 --- a/clippy_lints/src/needless_bool.rs +++ b/clippy_lints/src/needless_bool.rs @@ -166,7 +166,9 @@ impl<'tcx> LateLintPass<'tcx> for NeedlessBool { applicability, ); }; - if let Some((a, b)) = fetch_bool_block(then).and_then(|a| Some((a, fetch_bool_block(else_expr)?))) { + if let Some(a) = fetch_bool_block(then) + && let Some(b) = fetch_bool_block(else_expr) + { match (a, b) { (RetBool(true), RetBool(true)) | (Bool(true), Bool(true)) => { span_lint( |
