@@ -620,7 +620,7 @@ impl SourceMap {
620620 /// if no character could be found or if an error occurred while retrieving the code snippet.
621621 pub fn span_extend_to_prev_char ( & self , sp : Span , c : char ) -> Span {
622622 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 ( ) ;
624624 if !prev_source. is_empty ( ) && !prev_source. contains ( '\n' ) {
625625 return sp. with_lo ( BytePos ( sp. lo ( ) . 0 - prev_source. len ( ) as u32 ) ) ;
626626 }
@@ -640,7 +640,7 @@ impl SourceMap {
640640 for ws in & [ " " , "\t " , "\n " ] {
641641 let pat = pat. to_owned ( ) + ws;
642642 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 ( ) ;
644644 if !prev_source. is_empty ( ) && ( !prev_source. contains ( '\n' ) || accept_newlines) {
645645 return sp. with_lo ( BytePos ( sp. lo ( ) . 0 - prev_source. len ( ) as u32 ) ) ;
646646 }
@@ -655,7 +655,7 @@ impl SourceMap {
655655 pub fn span_until_char ( & self , sp : Span , c : char ) -> Span {
656656 match self . span_to_snippet ( sp) {
657657 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 ( ) ;
659659 if !snippet. is_empty ( ) && !snippet. contains ( '\n' ) {
660660 sp. with_hi ( BytePos ( sp. lo ( ) . 0 + snippet. len ( ) as u32 ) )
661661 } else {
0 commit comments