File tree Expand file tree Collapse file tree 1 file changed +5
-8
lines changed
compiler/rustc_parse/src/lexer Expand file tree Collapse file tree 1 file changed +5
-8
lines changed Original file line number Diff line number Diff line change @@ -64,14 +64,11 @@ impl<'a> StringReader<'a> {
6464 let mut spacing = Spacing :: Joint ;
6565
6666 // Skip `#!` at the start of the file
67- let start_src_index = self . src_index ( self . pos ) ;
68- let text: & str = & self . src [ start_src_index..self . end_src_index ] ;
69- let is_beginning_of_file = self . pos == self . start_pos ;
70- if is_beginning_of_file {
71- if let Some ( shebang_len) = rustc_lexer:: strip_shebang ( text) {
72- self . pos = self . pos + BytePos :: from_usize ( shebang_len) ;
73- spacing = Spacing :: Alone ;
74- }
67+ if self . pos == self . start_pos
68+ && let Some ( shebang_len) = rustc_lexer:: strip_shebang ( self . src )
69+ {
70+ self . pos = self . pos + BytePos :: from_usize ( shebang_len) ;
71+ spacing = Spacing :: Alone ;
7572 }
7673
7774 // Skip trivial (whitespace & comments) tokens
You can’t perform that action at this time.
0 commit comments