Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion library/core/src/num/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,9 @@ impl u8 {
#[rustc_const_stable(feature = "const_ascii_methods_on_intrinsics", since = "1.52.0")]
#[inline]
pub const fn eq_ignore_ascii_case(&self, other: &u8) -> bool {
self.to_ascii_lowercase() == other.to_ascii_lowercase()
#[allow(clippy::manual_ignore_case_cmp)] // exempt by being the one true definition
self.to_ascii_lowercase()
== other.to_ascii_lowercase()
}

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

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

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

Expand Down Expand Up @@ -778,6 +783,7 @@ impl u8 {
#[rustc_const_stable(feature = "const_ascii_ctype_on_intrinsics", since = "1.47.0")]
#[inline]
pub const fn is_ascii_alphanumeric(&self) -> bool {
#![allow(clippy::manual_is_ascii_check)] // exempt by being the one true definition
matches!(*self, b'0'..=b'9') | matches!(*self, b'A'..=b'Z') | matches!(*self, b'a'..=b'z')
}

Expand Down Expand Up @@ -812,6 +818,7 @@ impl u8 {
#[rustc_const_stable(feature = "const_ascii_ctype_on_intrinsics", since = "1.47.0")]
#[inline]
pub const fn is_ascii_digit(&self) -> bool {
#![allow(clippy::manual_is_ascii_check)] // exempt by being the one true definition
matches!(*self, b'0'..=b'9')
}

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

Expand Down Expand Up @@ -880,6 +888,7 @@ impl u8 {
#[rustc_const_stable(feature = "const_ascii_ctype_on_intrinsics", since = "1.47.0")]
#[inline]
pub const fn is_ascii_hexdigit(&self) -> bool {
#![allow(clippy::manual_is_ascii_check)] // exempt by being the one true definition
matches!(*self, b'0'..=b'9') | matches!(*self, b'A'..=b'F') | matches!(*self, b'a'..=b'f')
}

Expand Down
Loading