File tree 2 files changed +15
-2
lines changed
2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ swc_core : patch
3
+ swc_common : patch
4
+ ---
5
+
6
+ pref(es/common): use next rather than nth
Original file line number Diff line number Diff line change @@ -80,12 +80,19 @@ impl Input for StringInput<'_> {
80
80
81
81
#[ inline]
82
82
fn peek ( & mut self ) -> Option < char > {
83
- self . iter . clone ( ) . nth ( 1 )
83
+ let mut iter = self . iter . clone ( ) ;
84
+ // https://github.com/rust-lang/rust/blob/1.86.0/compiler/rustc_lexer/src/cursor.rs#L56 say `next` is faster.
85
+ iter. next ( ) ;
86
+ iter. next ( )
84
87
}
85
88
86
89
#[ inline]
87
90
fn peek_ahead ( & mut self ) -> Option < char > {
88
- self . iter . clone ( ) . nth ( 2 )
91
+ let mut iter = self . iter . clone ( ) ;
92
+ // https://github.com/rust-lang/rust/blob/1.86.0/compiler/rustc_lexer/src/cursor.rs#L56 say `next` is faster
93
+ iter. next ( ) ;
94
+ iter. next ( ) ;
95
+ iter. next ( )
89
96
}
90
97
91
98
#[ inline]
You can’t perform that action at this time.
0 commit comments