Skip to content
This repository has been archived by the owner on Nov 5, 2024. It is now read-only.

Commit

Permalink
Forgot to run Clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
WalrusGumboot committed Jan 4, 2024
1 parent 3edc04d commit e7c5b5e
Showing 1 changed file with 12 additions and 16 deletions.
28 changes: 12 additions & 16 deletions src/server/folding_range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,26 @@ impl TypstServer {
let mut starting_line: Option<u32> = None;
let mut ranges: Vec<FoldingRange> = Vec::new();

for symbol in symbols {
match symbol {
Ok(sym) => {
if let Some(prev_line) = starting_line {
ranges.push(FoldingRange {
start_line: prev_line,
end_line: sym.location.range.start.line - 1,
kind: Some(FoldingRangeKind::Region),
..Default::default()
})
}
for symbol in symbols.into_iter().flatten() {
if let Some(prev_line) = starting_line {
ranges.push(FoldingRange {
start_line: prev_line,
end_line: symbol.location.range.start.line - 1,
kind: Some(FoldingRangeKind::Region),
..Default::default()
})
}

starting_line = Some(sym.location.range.end.line)
}
Err(_) => {}
};
starting_line = Some(symbol.location.range.end.line)
}

// we've reached the end of the document but there was still an 'open' header
if let Some(prev_line) = starting_line {
ranges.push(FoldingRange {
start_line: prev_line,
end_line: <usize as TryInto<u32>>::try_into(source.len_lines())
.expect("Could not convert usize into u32") - 1,
.expect("Could not convert usize into u32")
- 1,
kind: Some(FoldingRangeKind::Region),
..Default::default()
})
Expand Down

0 comments on commit e7c5b5e

Please sign in to comment.