Tweak Cursor::next_with_spacing.

This makes it more like `CursorRef::next_with_spacing`. There is no
performance effect, just a consistency improvement.
This commit is contained in:
Nicholas Nethercote 2022-04-19 14:15:30 +10:00
parent 8305398d7a
commit ad566b78f2

View File

@ -586,12 +586,10 @@ impl Cursor {
}
pub fn next_with_spacing(&mut self) -> Option<TreeAndSpacing> {
if self.index < self.stream.len() {
self.stream.0.get(self.index).map(|tree| {
self.index += 1;
Some(self.stream.0[self.index - 1].clone())
} else {
None
}
tree.clone()
})
}
pub fn index(&self) -> usize {