File tree Expand file tree Collapse file tree 2 files changed +2
-8
lines changed Expand file tree Collapse file tree 2 files changed +2
-8
lines changed Original file line number Diff line number Diff line change @@ -528,15 +528,11 @@ impl ChiselDispatcher {
528
528
/// Preprocesses addresses to ensure they are correctly checksummed and returns whether the input
529
529
/// only contained trivia (comments, whitespace).
530
530
fn preprocess ( input : & str ) -> ( bool , Cow < ' _ , str > ) {
531
- let mut current_pos = 0 ;
532
531
let mut only_trivia = true ;
533
532
let mut new_input = Cow :: Borrowed ( input) ;
534
- for token in solar:: parse:: Cursor :: new ( input) {
533
+ for ( pos , token) in solar:: parse:: Cursor :: new ( input) . with_position ( ) {
535
534
use RawTokenKind :: * ;
536
535
537
- let pos = current_pos as usize ;
538
- current_pos += token. len ;
539
-
540
536
if matches ! ( token. kind, Whitespace | LineComment { .. } | BlockComment { .. } ) {
541
537
continue ;
542
538
}
Original file line number Diff line number Diff line change @@ -70,7 +70,6 @@ fn line_begin_pos(sf: &SourceFile, pos: BytePos) -> BytePos {
70
70
fn gather_comments ( sf : & SourceFile ) -> Vec < Comment > {
71
71
let text = sf. src . as_str ( ) ;
72
72
let start_bpos = sf. start_pos ;
73
- let mut pos = 0 ;
74
73
let mut comments: Vec < Comment > = Vec :: new ( ) ;
75
74
let mut code_to_the_left = false ;
76
75
@@ -89,7 +88,7 @@ fn gather_comments(sf: &SourceFile) -> Vec<Comment> {
89
88
}
90
89
*/
91
90
92
- for token in solar:: parse:: Cursor :: new ( & text[ pos.. ] ) {
91
+ for ( pos , token) in solar:: parse:: Cursor :: new ( text) . with_position ( ) {
93
92
let token_range = pos..pos + token. len as usize ;
94
93
let span = make_span ( token_range. clone ( ) ) ;
95
94
let token_text = & text[ token_range] ;
@@ -148,7 +147,6 @@ fn gather_comments(sf: &SourceFile) -> Vec<Comment> {
148
147
code_to_the_left = true ;
149
148
}
150
149
}
151
- pos += token. len as usize ;
152
150
}
153
151
154
152
comments
You can’t perform that action at this time.
0 commit comments