Skip to content

Commit 27784f2

Browse files
committed
use str::ends_with
1 parent 43f832d commit 27784f2

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

clippy_lints/src/collapsible_if.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,10 +141,7 @@ impl CollapsibleIf {
141141

142142
// Prevent "elseif"
143143
// Check that the "else" is followed by whitespace
144-
let requires_space = snippet(cx, up_to_else, "..")
145-
.chars()
146-
.last()
147-
.is_some_and(|c| !c.is_whitespace());
144+
let requires_space = snippet(cx, up_to_else, "..").ends_with(|c: char| !c.is_whitespace());
148145
let mut applicability = Applicability::MachineApplicable;
149146
diag.span_suggestion(
150147
else_block.span,

0 commit comments

Comments
 (0)