Consume trivia and attach it to the next content token for output preservation. This should be called when you want to consume whitespace/comments but preserve them for round-trip output fidelity.
(&mut self)
| 380 | /// This should be called when you want to consume whitespace/comments but preserve |
| 381 | /// them for round-trip output fidelity. |
| 382 | pub fn consume_trivia_as_leading(&mut self) { |
| 383 | let trivia = self.consume_trivia(); |
| 384 | if !trivia.is_empty() { |
| 385 | // Peek the next content token to attach trivia to it |
| 386 | let next = self.peek_n(1); |
| 387 | self.trivia.push((trivia, next)); |
| 388 | } |
| 389 | } |
| 390 | |
| 391 | #[allow(clippy::should_implement_trait)] |
| 392 | pub fn next(&mut self) -> Cursor { |
no test coverage detected