File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -462,16 +462,20 @@ impl fmt::Display for EscapeQuotedString<'_> {
462462 match ch {
463463 char if char == quote => {
464464 if previous_char == '\\' {
465+ // the quote is already escaped with a backslash, skip
465466 peekable_chars. next ( ) ;
466467 continue ;
467468 }
468469 peekable_chars. next ( ) ;
469470 match peekable_chars. peek ( ) {
470471 Some ( ( _, c) ) if * c == quote => {
472+ // the quote is already escaped with another quote, skip
471473 peekable_chars. next ( ) ;
472474 }
473475 _ => {
474- // not calling .next(), so the quote at idx will be printed twice
476+ // The quote is not escaped.
477+ // Not calling .next(), so the quote at idx will be printed twice:
478+ // in this call to write_str() and in the next one.
475479 f. write_str ( & self . string [ start_idx..=idx] ) ?;
476480 start_idx = idx;
477481 }
You can’t perform that action at this time.
0 commit comments