Rollup merge of #155531 - Jules-Bertholet:is_ascii_punctuation_docs, r=scottmcm

Tweak `is_ascii_punctuation()` docs wording

These methods return `true` for characters with Unicode general category of punctuation (P), but also for those with general category of symbol (S).

@rustbot label A-docs
This commit is contained in:
Jonathan Brouwer
2026-04-20 08:14:14 +02:00
committed by GitHub
3 changed files with 12 additions and 6 deletions
+4 -2
View File
@@ -949,7 +949,8 @@ pub const fn is_hexdigit(self) -> bool {
self.to_u8().is_ascii_hexdigit()
}
/// Checks if the value is a punctuation character:
/// Checks if the value is a punctuation or symbol character
/// (i.e. not alphanumeric, whitespace, or control):
///
/// - 0x21 ..= 0x2F `! " # $ % & ' ( ) * + , - . /`, or
/// - 0x3A ..= 0x40 `: ; < = > ? @`, or
@@ -989,7 +990,8 @@ pub const fn is_punctuation(self) -> bool {
self.to_u8().is_ascii_punctuation()
}
/// Checks if the value is a graphic character:
/// Checks if the value is a graphic character
/// (i.e. not whitespace or control):
/// 0x21 '!' ..= 0x7E '~'.
///
/// # Examples
+4 -2
View File
@@ -1984,7 +1984,8 @@ pub const fn is_ascii_hexdigit(&self) -> bool {
matches!(*self, '0'..='9') | matches!(*self, 'A'..='F') | matches!(*self, 'a'..='f')
}
/// Checks if the value is an ASCII punctuation character:
/// Checks if the value is an ASCII punctuation or symbol character
/// (i.e. not alphanumeric, whitespace, or control):
///
/// - U+0021 ..= U+002F `! " # $ % & ' ( ) * + , - . /`, or
/// - U+003A ..= U+0040 `: ; < = > ? @`, or
@@ -2025,7 +2026,8 @@ pub const fn is_ascii_punctuation(&self) -> bool {
| matches!(*self, '{'..='~')
}
/// Checks if the value is an ASCII graphic character:
/// Checks if the value is an ASCII graphic character
/// (i.e. not whitespace or control):
/// U+0021 '!' ..= U+007E '~'.
///
/// # Examples
+4 -2
View File
@@ -986,7 +986,8 @@ pub const fn is_ascii_hexdigit(&self) -> bool {
matches!(*self, b'0'..=b'9') | matches!(*self, b'A'..=b'F') | matches!(*self, b'a'..=b'f')
}
/// Checks if the value is an ASCII punctuation character:
/// Checks if the value is an ASCII punctuation or symbol character
/// (i.e. not alphanumeric, whitespace, or control):
///
/// - U+0021 ..= U+002F `! " # $ % & ' ( ) * + , - . /`, or
/// - U+003A ..= U+0040 `: ; < = > ? @`, or
@@ -1027,7 +1028,8 @@ pub const fn is_ascii_punctuation(&self) -> bool {
| matches!(*self, b'{'..=b'~')
}
/// Checks if the value is an ASCII graphic character:
/// Checks if the value is an ASCII graphic character
/// (i.e. not whitespace or control):
/// U+0021 '!' ..= U+007E '~'.
///
/// # Examples