@@ -98,15 +98,15 @@ impl<'original, S: Span> CachingOffsetCalculator<'original, S> {
9898 // smoelius: Ensure `chars` is refilled the next time `chars_mut` is called.
9999 self . chars = None ;
100100
101- self . offset += suffix. as_bytes ( ) . len ( ) + 1 ;
101+ self . offset += suffix. len ( ) + 1 ;
102102 self . ascii &= suffix. is_ascii ( ) ;
103103 * self . line_column . line_mut ( ) += 1 ;
104104 * self . line_column . column_mut ( ) = 0 ;
105105
106106 while self . line_column . line ( ) < line {
107107 let line = self . next_line ( ) ;
108108
109- self . offset += line. as_bytes ( ) . len ( ) + 1 ;
109+ self . offset += line. len ( ) + 1 ;
110110 self . ascii &= line. is_ascii ( ) ;
111111 * self . line_column . line_mut ( ) += 1 ;
112112 * self . line_column . column_mut ( ) = 0 ;
@@ -135,7 +135,7 @@ impl<'original, S: Span> CachingOffsetCalculator<'original, S> {
135135
136136fn advance_chars ( chars : & mut Chars , n : usize ) -> ( usize , bool ) {
137137 let prefix = chars. take ( n) . collect :: < String > ( ) ;
138- let offset = prefix. as_bytes ( ) . len ( ) ;
138+ let offset = prefix. len ( ) ;
139139 let ascii = prefix. is_ascii ( ) ;
140140 ( offset, ascii)
141141}
@@ -153,7 +153,7 @@ impl<S: Span> Interface<S> for StatelessOffsetCalculator<'_, S> {
153153
154154 for _ in 1 ..line_column. line ( ) {
155155 let line = lines. next ( ) . unwrap ( ) ;
156- offset += line. as_bytes ( ) . len ( ) + 1 ;
156+ offset += line. len ( ) + 1 ;
157157 ascii &= line. is_ascii ( ) ;
158158 }
159159
@@ -163,7 +163,7 @@ impl<S: Span> Interface<S> for StatelessOffsetCalculator<'_, S> {
163163 . chars ( )
164164 . take ( line_column. column ( ) )
165165 . collect :: < String > ( ) ;
166- offset += prefix. as_bytes ( ) . len ( ) ;
166+ offset += prefix. len ( ) ;
167167 ascii &= prefix. is_ascii ( ) ;
168168
169169 ( offset, ascii)
0 commit comments