use Option::is_some_and

This commit is contained in:
Ada Alakbarova
2025-08-16 15:36:24 +02:00
parent aa8b09d468
commit 43f832d37b

View File

@@ -141,11 +141,10 @@ impl CollapsibleIf {
// Prevent "elseif"
// Check that the "else" is followed by whitespace
let requires_space = if let Some(c) = snippet(cx, up_to_else, "..").chars().last() {
!c.is_whitespace()
} else {
false
};
let requires_space = snippet(cx, up_to_else, "..")
.chars()
.last()
.is_some_and(|c| !c.is_whitespace());
let mut applicability = Applicability::MachineApplicable;
diag.span_suggestion(
else_block.span,