mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-26 13:01:27 +03:00
Fix comment on is_horizontal_whitespace
The comment on `is_horizontal_whitespace` says "This is Pattern_White_Space", but the function matches only tab (U+0009) and space (U+0020) -- two of the eleven `Pattern_White_Space` code points. This has been the case since Rust PR 146106, which narrowed the set from full `Pattern_White_Space` to the horizontal subset. The correct characterization is that this is the horizontal space subset of `Pattern_White_Space`, as categorized by UAX 31, Section 4.1, which partitions `Pattern_White_Space` into line endings, ignorable format controls, and horizontal space.
This commit is contained in:
@@ -367,7 +367,8 @@ pub fn is_whitespace(c: char) -> bool {
|
||||
|
||||
/// True if `c` is considered horizontal whitespace according to Rust language definition.
|
||||
pub fn is_horizontal_whitespace(c: char) -> bool {
|
||||
// This is Pattern_White_Space.
|
||||
// This is the horizontal space subset of `Pattern_White_Space` as
|
||||
// categorized by UAX #31, Section 4.1.
|
||||
//
|
||||
// Note that this set is stable (ie, it doesn't change with different
|
||||
// Unicode versions), so it's ok to just hard-code the values.
|
||||
|
||||
Reference in New Issue
Block a user