clippy: Fix various clippy warnings in components/scripts/dom/bindings (#31901)

* single-character string constant used as pattern

* singuse of  with literal radix of 16
This commit is contained in:
Rosemary Ajayi 2024-03-28 12:49:36 +01:00 committed by GitHub
parent 18054d0737
commit 7100465d1a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 3 deletions

View file

@ -237,7 +237,7 @@ pub struct ThreadLocalStackRoots<'a>(PhantomData<&'a u32>);
impl<'a> ThreadLocalStackRoots<'a> { impl<'a> ThreadLocalStackRoots<'a> {
pub fn new(roots: &'a RootCollection) -> Self { pub fn new(roots: &'a RootCollection) -> Self {
STACK_ROOTS.with(|ref r| r.set(Some(roots))); STACK_ROOTS.with(|r| r.set(Some(roots)));
ThreadLocalStackRoots(PhantomData) ThreadLocalStackRoots(PhantomData)
} }
} }

View file

@ -443,7 +443,7 @@ impl DOMString {
if !( if !(
// A valid number is the same as what rust considers to be valid, // A valid number is the same as what rust considers to be valid,
// except for +1., NaN, and Infinity. // except for +1., NaN, and Infinity.
val.is_infinite() || val.is_nan() || input.ends_with(".") || input.starts_with("+") val.is_infinite() || val.is_nan() || input.ends_with(".") || input.starts_with('+')
) { ) {
return Some(val); return Some(val);
} }
@ -529,7 +529,7 @@ impl DOMString {
pub fn is_valid_simple_color_string(&self) -> bool { pub fn is_valid_simple_color_string(&self) -> bool {
let mut chars = self.0.chars(); let mut chars = self.0.chars();
if self.0.len() == 7 && chars.next() == Some('#') { if self.0.len() == 7 && chars.next() == Some('#') {
chars.all(|c| c.is_digit(16)) chars.all(|c| c.is_ascii_hexdigit())
} else { } else {
false false
} }