Skip to content

Commit 43f832d

Browse files
committed
use Option::is_some_and
1 parent aa8b09d commit 43f832d

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

clippy_lints/src/collapsible_if.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -141,11 +141,10 @@ impl CollapsibleIf {
141141

142142
// Prevent "elseif"
143143
// Check that the "else" is followed by whitespace
144-
let requires_space = if let Some(c) = snippet(cx, up_to_else, "..").chars().last() {
145-
!c.is_whitespace()
146-
} else {
147-
false
148-
};
144+
let requires_space = snippet(cx, up_to_else, "..")
145+
.chars()
146+
.last()
147+
.is_some_and(|c| !c.is_whitespace());
149148
let mut applicability = Applicability::MachineApplicable;
150149
diag.span_suggestion(
151150
else_block.span,

0 commit comments

Comments
 (0)