Skip to content

Commit fd65209

Browse files
Tweak is_ascii_punctuation()/graphic() docs wording
The `_punctuation` methods return `true` for characters with Unicode general category of punctuation (P), but also for those with general category of symbol (S).
1 parent e22c616 commit fd65209

3 files changed

Lines changed: 12 additions & 6 deletions

File tree

library/core/src/ascii/ascii_char.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -949,7 +949,8 @@ impl AsciiChar {
949949
self.to_u8().is_ascii_hexdigit()
950950
}
951951

952-
/// Checks if the value is a punctuation character:
952+
/// Checks if the value is a punctuation or symbol character
953+
/// (i.e. not alphanumeric, whitespace, or control):
953954
///
954955
/// - 0x21 ..= 0x2F `! " # $ % & ' ( ) * + , - . /`, or
955956
/// - 0x3A ..= 0x40 `: ; < = > ? @`, or
@@ -989,7 +990,8 @@ impl AsciiChar {
989990
self.to_u8().is_ascii_punctuation()
990991
}
991992

992-
/// Checks if the value is a graphic character:
993+
/// Checks if the value is a graphic character
994+
/// (i.e. not whitespace or control):
993995
/// 0x21 '!' ..= 0x7E '~'.
994996
///
995997
/// # Examples

library/core/src/char/methods.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1984,7 +1984,8 @@ impl char {
19841984
matches!(*self, '0'..='9') | matches!(*self, 'A'..='F') | matches!(*self, 'a'..='f')
19851985
}
19861986

1987-
/// Checks if the value is an ASCII punctuation character:
1987+
/// Checks if the value is an ASCII punctuation or symbol character
1988+
/// (i.e. not alphanumeric, whitespace, or control):
19881989
///
19891990
/// - U+0021 ..= U+002F `! " # $ % & ' ( ) * + , - . /`, or
19901991
/// - U+003A ..= U+0040 `: ; < = > ? @`, or
@@ -2025,7 +2026,8 @@ impl char {
20252026
| matches!(*self, '{'..='~')
20262027
}
20272028

2028-
/// Checks if the value is an ASCII graphic character:
2029+
/// Checks if the value is an ASCII graphic character
2030+
/// (i.e. not whitespace or control):
20292031
/// U+0021 '!' ..= U+007E '~'.
20302032
///
20312033
/// # Examples

library/core/src/num/mod.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -986,7 +986,8 @@ impl u8 {
986986
matches!(*self, b'0'..=b'9') | matches!(*self, b'A'..=b'F') | matches!(*self, b'a'..=b'f')
987987
}
988988

989-
/// Checks if the value is an ASCII punctuation character:
989+
/// Checks if the value is an ASCII punctuation or symbol character
990+
/// (i.e. not alphanumeric, whitespace, or control):
990991
///
991992
/// - U+0021 ..= U+002F `! " # $ % & ' ( ) * + , - . /`, or
992993
/// - U+003A ..= U+0040 `: ; < = > ? @`, or
@@ -1027,7 +1028,8 @@ impl u8 {
10271028
| matches!(*self, b'{'..=b'~')
10281029
}
10291030

1030-
/// Checks if the value is an ASCII graphic character:
1031+
/// Checks if the value is an ASCII graphic character
1032+
/// (i.e. not whitespace or control):
10311033
/// U+0021 '!' ..= U+007E '~'.
10321034
///
10331035
/// # Examples

0 commit comments

Comments
 (0)