Skip to content

Commit 10c5e5b

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

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

‎library/core/src/num/mod.rs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,9 @@ impl u8 {
585585
#[rustc_const_stable(feature = "const_ascii_methods_on_intrinsics", since = "1.52.0")]
586586
#[inline]
587587
pub const fn eq_ignore_ascii_case(&self, other: &u8) -> bool {
588-
self.to_ascii_lowercase() == other.to_ascii_lowercase()
588+
#[allow(clippy::manual_ignore_case_cmp)] // exempt by being the one true definition
589+
self.to_ascii_lowercase()
590+
== other.to_ascii_lowercase()
589591
}
590592

591593
/// Converts this value to its ASCII upper case equivalent in-place.
@@ -673,6 +675,7 @@ impl u8 {
673675
#[rustc_const_stable(feature = "const_ascii_ctype_on_intrinsics", since = "1.47.0")]
674676
#[inline]
675677
pub const fn is_ascii_alphabetic(&self) -> bool {
678+
#![allow(clippy::manual_is_ascii_check)] // exempt by being the one true definition
676679
matches!(*self, b'A'..=b'Z' | b'a'..=b'z')
677680
}
678681

@@ -707,6 +710,7 @@ impl u8 {
707710
#[rustc_const_stable(feature = "const_ascii_ctype_on_intrinsics", since = "1.47.0")]
708711
#[inline]
709712
pub const fn is_ascii_uppercase(&self) -> bool {
713+
#![allow(clippy::manual_is_ascii_check)] // exempt by being the one true definition
710714
matches!(*self, b'A'..=b'Z')
711715
}
712716

@@ -741,6 +745,7 @@ impl u8 {
741745
#[rustc_const_stable(feature = "const_ascii_ctype_on_intrinsics", since = "1.47.0")]
742746
#[inline]
743747
pub const fn is_ascii_lowercase(&self) -> bool {
748+
#![allow(clippy::manual_is_ascii_check)] // exempt by being the one true definition
744749
matches!(*self, b'a'..=b'z')
745750
}
746751

@@ -778,7 +783,8 @@ impl u8 {
778783
#[rustc_const_stable(feature = "const_ascii_ctype_on_intrinsics", since = "1.47.0")]
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+
#![allow(clippy::manual_is_ascii_check)] // exempt by being the one true definition
787+
matches!(*self, b'0'..=b'9' | b'A'..=b'Z' | b'a'..=b'z')
782788
}
783789

784790
/// Checks if the value is an ASCII decimal digit:
@@ -812,6 +818,7 @@ impl u8 {
812818
#[rustc_const_stable(feature = "const_ascii_ctype_on_intrinsics", since = "1.47.0")]
813819
#[inline]
814820
pub const fn is_ascii_digit(&self) -> bool {
821+
#![allow(clippy::manual_is_ascii_check)] // exempt by being the one true definition
815822
matches!(*self, b'0'..=b'9')
816823
}
817824

@@ -843,6 +850,7 @@ impl u8 {
843850
#[unstable(feature = "is_ascii_octdigit", issue = "101288")]
844851
#[inline]
845852
pub const fn is_ascii_octdigit(&self) -> bool {
853+
#![allow(clippy::manual_is_ascii_check)] // exempt by being the one true definition
846854
matches!(*self, b'0'..=b'7')
847855
}
848856

@@ -880,7 +888,8 @@ impl u8 {
880888
#[rustc_const_stable(feature = "const_ascii_ctype_on_intrinsics", since = "1.47.0")]
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+
#![allow(clippy::manual_is_ascii_check)] // exempt by being the one true definition
892+
matches!(*self, b'0'..=b'9' | b'A'..=b'F' | b'a'..=b'f')
884893
}
885894

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

0 commit comments

Comments
 (0)