mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-04 09:53:04 +03:00
Inline char_at() and record_width.
Because `bump()` is hot.
This commit is contained in:
@@ -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()
|
||||
}
|
||||
|
||||
@@ -1047,6 +1047,7 @@ pub fn record_multibyte_char(&self, pos: BytePos, bytes: usize) {
|
||||
self.multibyte_chars.borrow_mut().push(mbc);
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn record_width(&self, pos: BytePos, ch: char) {
|
||||
let width = match ch {
|
||||
'\t' =>
|
||||
|
||||
Reference in New Issue
Block a user