Skip to content

Commit 75015b6

Browse files
bestia-devVeykril
andauthored
Update crates/ide/src/folding_ranges.rs
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
1 parent 084b21b commit 75015b6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

crates/ide/src/folding_ranges.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,10 @@ pub(crate) fn folding_ranges(file: &SourceFile) -> Vec<Fold> {
5555
if comment.text().trim().starts_with("// region:") {
5656
regions_starts.push(comment.syntax().text_range().start());
5757
} else if comment.text().trim().starts_with("// endregion") {
58-
if !regions_starts.is_empty() {
58+
if let Some(region) = regions_starts.pop() {
5959
res.push(Fold {
6060
range: TextRange::new(
61-
regions_starts.pop().unwrap(),
61+
region,
6262
comment.syntax().text_range().end(),
6363
),
6464
kind: FoldKind::Region,

0 commit comments

Comments
 (0)