Skip to content

Commit

Permalink
clippy: Fix various clippy warnings in `components/scripts/dom/bindin…
Browse files Browse the repository at this point in the history
…gs` (#31901)

* single-character string constant used as pattern

* singuse of  with literal radix of 16
  • Loading branch information
six-shot committed Mar 28, 2024
1 parent 18054d0 commit 7100465
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion components/script/dom/bindings/root.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ pub struct ThreadLocalStackRoots<'a>(PhantomData<&'a u32>);

impl<'a> ThreadLocalStackRoots<'a> {
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)
}
}
Expand Down
4 changes: 2 additions & 2 deletions components/script/dom/bindings/str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ impl DOMString {
if !(
// A valid number is the same as what rust considers to be valid,
// 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);
}
Expand Down Expand Up @@ -529,7 +529,7 @@ impl DOMString {
pub fn is_valid_simple_color_string(&self) -> bool {
let mut chars = self.0.chars();
if self.0.len() == 7 && chars.next() == Some('#') {
chars.all(|c| c.is_digit(16))
chars.all(|c| c.is_ascii_hexdigit())
} else {
false
}
Expand Down

0 comments on commit 7100465

Please sign in to comment.