diff options
Diffstat (limited to 'library/core/src/char/methods.rs')
| -rw-r--r-- | library/core/src/char/methods.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/library/core/src/char/methods.rs b/library/core/src/char/methods.rs index 7ee0962721f..61ac7f8a339 100644 --- a/library/core/src/char/methods.rs +++ b/library/core/src/char/methods.rs @@ -950,7 +950,11 @@ impl char { #[stable(feature = "rust1", since = "1.0.0")] #[inline] pub fn is_control(self) -> bool { - unicode::Cc(self) + // According to + // https://www.unicode.org/policies/stability_policy.html#Property_Value, + // the set of codepoints in `Cc` will never change. + // So we can just hard-code the patterns to match against instead of using a table. + matches!(self, '\0'..='\x1f' | '\x7f'..='\u{9f}') } /// Returns `true` if this `char` has the `Grapheme_Extend` property. |
