Help the compiler inline read_break
.
This commit is contained in:
parent
5789169ceb
commit
2cebf0af1d
1 changed files with 7 additions and 9 deletions
|
@ -513,20 +513,18 @@ impl<T: Iterator<Item = char>> Scanner<T> {
|
||||||
//
|
//
|
||||||
// A `\n` is pushed into `s`.
|
// A `\n` is pushed into `s`.
|
||||||
//
|
//
|
||||||
// # Panics
|
// # Panics (in debug)
|
||||||
// If the next characters do not correspond to a line break.
|
// If the next characters do not correspond to a line break.
|
||||||
#[inline]
|
#[inline]
|
||||||
fn read_break(&mut self, s: &mut String) {
|
fn read_break(&mut self, s: &mut String) {
|
||||||
if self.buffer[0] == '\r' && self.buffer[1] == '\n' {
|
let c = self.buffer[0];
|
||||||
s.push('\n');
|
debug_assert!(is_break(c));
|
||||||
|
self.skip();
|
||||||
|
if c == '\r' && self.buffer[0] == '\n' {
|
||||||
self.skip();
|
self.skip();
|
||||||
self.skip();
|
|
||||||
} else if self.buffer[0] == '\r' || self.buffer[0] == '\n' {
|
|
||||||
s.push('\n');
|
|
||||||
self.skip();
|
|
||||||
} else {
|
|
||||||
unreachable!();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
s.push('\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Check whether the next characters correspond to an end of document.
|
/// Check whether the next characters correspond to an end of document.
|
||||||
|
|
Loading…
Reference in a new issue