File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -13,9 +13,9 @@ pub type CommentsMap = FxHashMap</* attached_to */ u32, Vec<Comment>>;
1313/// This avoids creating empty strings between CR and LF characters.
1414///
1515/// # Example
16- /// Standard split would turn "line1\r\nline2" into ["line1", "", "line2"] because
16+ /// Standard split would turn ` "line1\r\nline2"` into ` ["line1", "", "line2"]` because
1717/// it treats \r and \n as separate terminators. This iterator correctly produces
18- /// ["line1", "line2"] by treating \r\n as a single terminator.
18+ /// ` ["line1", "line2"]` by treating \r\n as a single terminator.
1919struct LineTerminatorSplitter < ' a > {
2020 text : & ' a str ,
2121 position : usize ,
@@ -36,9 +36,9 @@ impl<'a> Iterator for LineTerminatorSplitter<'a> {
3636 }
3737
3838 let start = self . position ;
39- let mut chars = self . text [ self . position ..] . char_indices ( ) ;
39+ let chars = self . text [ self . position ..] . char_indices ( ) ;
4040
41- while let Some ( ( i, c) ) = chars. next ( ) {
41+ for ( i, c) in chars {
4242 if is_line_terminator ( c) {
4343 let line = & self . text [ start..start + i] ;
4444 self . position = start + i + c. len_utf8 ( ) ;
You can’t perform that action at this time.
0 commit comments