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:
Travis Cross
2026-03-04 05:53:51 +00:00
parent d933cf483e
commit fe71b660c5
+2 -1
View File
@@ -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.