1
Fork 0

Inline char_at() and record_width.

Because `bump()` is hot.
This commit is contained in:
Nicholas Nethercote 2018-05-03 17:14:04 +10:00
parent 6fc409ed09
commit 4465b2fbf3
2 changed files with 2 additions and 0 deletions

View file

@ -8,6 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[inline]
pub fn char_at(s: &str, byte: usize) -> char {
s[byte..].chars().next().unwrap()
}

View file

@ -1047,6 +1047,7 @@ impl FileMap {
self.multibyte_chars.borrow_mut().push(mbc);
}
#[inline]
pub fn record_width(&self, pos: BytePos, ch: char) {
let width = match ch {
'\t' =>