Skip to content

Commit 388d3f3

Browse files
use a let-chain in needless_bool (#15444)
This is a small thing I noticed while looking into #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
2 parents 2208884 + 82c1ce7 commit 388d3f3

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

clippy_lints/src/needless_bool.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,9 @@ impl<'tcx> LateLintPass<'tcx> for NeedlessBool {
166166
applicability,
167167
);
168168
};
169-
if let Some((a, b)) = fetch_bool_block(then).and_then(|a| Some((a, fetch_bool_block(else_expr)?))) {
169+
if let Some(a) = fetch_bool_block(then)
170+
&& let Some(b) = fetch_bool_block(else_expr)
171+
{
170172
match (a, b) {
171173
(RetBool(true), RetBool(true)) | (Bool(true), Bool(true)) => {
172174
span_lint(

0 commit comments

Comments
 (0)