@@ -620,7 +620,7 @@ impl SourceMap {
620
620
/// if no character could be found or if an error occurred while retrieving the code snippet.
621
621
pub fn span_extend_to_prev_char ( & self , sp : Span , c : char ) -> Span {
622
622
if let Ok ( prev_source) = self . span_to_prev_source ( sp) {
623
- let prev_source = prev_source. rsplit ( c) . nth ( 0 ) . unwrap_or ( "" ) . trim_start ( ) ;
623
+ let prev_source = prev_source. rsplit ( c) . next ( ) . unwrap_or ( "" ) . trim_start ( ) ;
624
624
if !prev_source. is_empty ( ) && !prev_source. contains ( '\n' ) {
625
625
return sp. with_lo ( BytePos ( sp. lo ( ) . 0 - prev_source. len ( ) as u32 ) ) ;
626
626
}
@@ -640,7 +640,7 @@ impl SourceMap {
640
640
for ws in & [ " " , "\t " , "\n " ] {
641
641
let pat = pat. to_owned ( ) + ws;
642
642
if let Ok ( prev_source) = self . span_to_prev_source ( sp) {
643
- let prev_source = prev_source. rsplit ( & pat) . nth ( 0 ) . unwrap_or ( "" ) . trim_start ( ) ;
643
+ let prev_source = prev_source. rsplit ( & pat) . next ( ) . unwrap_or ( "" ) . trim_start ( ) ;
644
644
if !prev_source. is_empty ( ) && ( !prev_source. contains ( '\n' ) || accept_newlines) {
645
645
return sp. with_lo ( BytePos ( sp. lo ( ) . 0 - prev_source. len ( ) as u32 ) ) ;
646
646
}
@@ -655,7 +655,7 @@ impl SourceMap {
655
655
pub fn span_until_char ( & self , sp : Span , c : char ) -> Span {
656
656
match self . span_to_snippet ( sp) {
657
657
Ok ( snippet) => {
658
- let snippet = snippet. split ( c) . nth ( 0 ) . unwrap_or ( "" ) . trim_end ( ) ;
658
+ let snippet = snippet. split ( c) . next ( ) . unwrap_or ( "" ) . trim_end ( ) ;
659
659
if !snippet. is_empty ( ) && !snippet. contains ( '\n' ) {
660
660
sp. with_hi ( BytePos ( sp. lo ( ) . 0 + snippet. len ( ) as u32 ) )
661
661
} else {
0 commit comments