Skip to content

Commit efba40e

Browse files
committed
allow clippy manual ascii check for definitions of them
1 parent f51c987 commit efba40e

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

library/core/src/num/mod.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -584,6 +584,7 @@ impl u8 {
584584
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.23.0")]
585585
#[rustc_const_stable(feature = "const_ascii_methods_on_intrinsics", since = "1.52.0")]
586586
#[inline]
587+
#[allow(clippy::manual_ignore_case_cmp)] // exempt by being the one true definition
587588
pub const fn eq_ignore_ascii_case(&self, other: &u8) -> bool {
588589
self.to_ascii_lowercase() == other.to_ascii_lowercase()
589590
}
@@ -671,6 +672,7 @@ impl u8 {
671672
#[must_use]
672673
#[stable(feature = "ascii_ctype_on_intrinsics", since = "1.24.0")]
673674
#[rustc_const_stable(feature = "const_ascii_ctype_on_intrinsics", since = "1.47.0")]
675+
#[allow(clippy::manual_is_ascii_check)] // exempt by being the one true definition
674676
#[inline]
675677
pub const fn is_ascii_alphabetic(&self) -> bool {
676678
matches!(*self, b'A'..=b'Z' | b'a'..=b'z')
@@ -705,6 +707,7 @@ impl u8 {
705707
#[must_use]
706708
#[stable(feature = "ascii_ctype_on_intrinsics", since = "1.24.0")]
707709
#[rustc_const_stable(feature = "const_ascii_ctype_on_intrinsics", since = "1.47.0")]
710+
#[allow(clippy::manual_is_ascii_check)] // exempt by being the one true definition
708711
#[inline]
709712
pub const fn is_ascii_uppercase(&self) -> bool {
710713
matches!(*self, b'A'..=b'Z')
@@ -739,6 +742,7 @@ impl u8 {
739742
#[must_use]
740743
#[stable(feature = "ascii_ctype_on_intrinsics", since = "1.24.0")]
741744
#[rustc_const_stable(feature = "const_ascii_ctype_on_intrinsics", since = "1.47.0")]
745+
#[allow(clippy::manual_is_ascii_check)] // exempt by being the one true definition
742746
#[inline]
743747
pub const fn is_ascii_lowercase(&self) -> bool {
744748
matches!(*self, b'a'..=b'z')
@@ -776,9 +780,10 @@ impl u8 {
776780
#[must_use]
777781
#[stable(feature = "ascii_ctype_on_intrinsics", since = "1.24.0")]
778782
#[rustc_const_stable(feature = "const_ascii_ctype_on_intrinsics", since = "1.47.0")]
783+
#[allow(clippy::manual_is_ascii_check)] // exempt by being the one true definition
779784
#[inline]
780785
pub const fn is_ascii_alphanumeric(&self) -> bool {
781-
matches!(*self, b'0'..=b'9') | matches!(*self, b'A'..=b'Z') | matches!(*self, b'a'..=b'z')
786+
matches!(*self, b'0'..=b'9' | b'A'..=b'Z' | b'a'..=b'z')
782787
}
783788

784789
/// Checks if the value is an ASCII decimal digit:
@@ -810,6 +815,7 @@ impl u8 {
810815
#[must_use]
811816
#[stable(feature = "ascii_ctype_on_intrinsics", since = "1.24.0")]
812817
#[rustc_const_stable(feature = "const_ascii_ctype_on_intrinsics", since = "1.47.0")]
818+
#[allow(clippy::manual_is_ascii_check)] // exempt by being the one true definition
813819
#[inline]
814820
pub const fn is_ascii_digit(&self) -> bool {
815821
matches!(*self, b'0'..=b'9')
@@ -841,6 +847,7 @@ impl u8 {
841847
/// ```
842848
#[must_use]
843849
#[unstable(feature = "is_ascii_octdigit", issue = "101288")]
850+
#[allow(clippy::manual_is_ascii_check)] // exempt by being the one true definition
844851
#[inline]
845852
pub const fn is_ascii_octdigit(&self) -> bool {
846853
matches!(*self, b'0'..=b'7')
@@ -878,9 +885,10 @@ impl u8 {
878885
#[must_use]
879886
#[stable(feature = "ascii_ctype_on_intrinsics", since = "1.24.0")]
880887
#[rustc_const_stable(feature = "const_ascii_ctype_on_intrinsics", since = "1.47.0")]
888+
#[allow(clippy::manual_is_ascii_check)] // exempt by being the one true definition
881889
#[inline]
882890
pub const fn is_ascii_hexdigit(&self) -> bool {
883-
matches!(*self, b'0'..=b'9') | matches!(*self, b'A'..=b'F') | matches!(*self, b'a'..=b'f')
891+
matches!(*self, b'0'..=b'9' | b'A'..=b'F' | b'a'..=b'f')
884892
}
885893

886894
/// Checks if the value is an ASCII punctuation character:

0 commit comments

Comments
 (0)