File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -360,7 +360,16 @@ fn is_new_line(grapheme: &str) -> bool {
360360}
361361
362362fn is_whitespace ( grapheme : & str ) -> bool {
363- grapheme. chars ( ) . all ( char:: is_whitespace)
363+ // We explicitly match these characters instead of using char::is_whitespace
364+ // because char::is_whitespace uses Unicode White_Space which is broader
365+ // than the Rust language's definition of whitespace. For example it would
366+ // also match \u{A0} (non-breaking space). \x0B (vertical tab) and \x0C
367+ // (form feed) are included here because the Rust language defines them
368+ // as whitespace, but is_ascii_whitespace excludes them.
369+
370+ grapheme
371+ . chars ( )
372+ . all ( |c| matches ! ( c, ' ' | '\t' | '\n' | '\r' | '\x0B' | '\x0C' ) )
364373}
365374
366375fn is_punctuation ( grapheme : & str ) -> bool {
Original file line number Diff line number Diff line change 1+ // Test Unicode whitespace characters in string literal line continuation
2+ fn main ( ) {
3+ let str = "hello \
4+ world";
5+ }
Original file line number Diff line number Diff line change 1+ // Test Unicode whitespace characters in string literal line continuation
2+ fn main ( ) {
3+ let str = "hello \
4+ world";
5+ }
You can’t perform that action at this time.
0 commit comments