Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/wrap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,13 @@ impl<'a> SpansWrapper<'a> {
if let Some(s) = self.pending.take() {
span = Some(s);
} else if self.index < self.spans.len() {
span = Some(self.spans.get(self.index).cloned().unwrap());
self.index += 1;
match self.spans.get(self.index).cloned() {
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @5ylar for the patch! Maybe I'm missing something, could you clarify in which scenario would the unwrap panic if we've checked that self.index is within bound? A test case would be helpful.

Some(_span) => {
span = Some(_span);
self.index += 1;
}
None => {}
}
}
if let Some(span) = span {
let newline_pos = span.content.find('\n');
Expand Down