diff --git a/components/script/dom/baseaudiocontext.rs b/components/script/dom/baseaudiocontext.rs index cfbc2516925..d0cfc8ab203 100644 --- a/components/script/dom/baseaudiocontext.rs +++ b/components/script/dom/baseaudiocontext.rs @@ -5,7 +5,6 @@ use std::cell::Cell; use std::collections::hash_map::Entry; use std::collections::{HashMap, VecDeque}; -use std::mem; use std::rc::Rc; use std::sync::{Arc, Mutex}; diff --git a/components/script/dom/bindings/refcounted.rs b/components/script/dom/bindings/refcounted.rs index 3e856b63d0f..784e71ff3aa 100644 --- a/components/script/dom/bindings/refcounted.rs +++ b/components/script/dom/bindings/refcounted.rs @@ -247,7 +247,7 @@ impl LiveDOMReferences { #[allow(crown::unrooted_must_root)] fn addref_promise(&self, promise: Rc) { let mut table = self.promise_table.borrow_mut(); - table.entry(&*promise).or_insert(vec![]).push(promise) + table.entry(&*promise).or_default().push(promise) } /// ptr must be a pointer to a type that implements DOMObject. @@ -297,7 +297,7 @@ fn remove_nulls(table: &mut HashMap>) { #[allow(crown::unrooted_must_root)] pub unsafe fn trace_refcounted_objects(tracer: *mut JSTracer) { info!("tracing live refcounted references"); - LIVE_REFERENCES.with(|ref r| { + LIVE_REFERENCES.with(|r| { let r = r.borrow(); let live_references = r.as_ref().unwrap(); { diff --git a/components/script/dom/bindings/root.rs b/components/script/dom/bindings/root.rs index 088f93d12e0..906816f4812 100644 --- a/components/script/dom/bindings/root.rs +++ b/components/script/dom/bindings/root.rs @@ -64,7 +64,7 @@ where pub unsafe fn new(value: T) -> Self { unsafe fn add_to_root_list(object: *const dyn JSTraceable) -> *const RootCollection { assert_in_script(); - STACK_ROOTS.with(|ref root_list| { + STACK_ROOTS.with(|root_list| { let root_list = &*root_list.get().unwrap(); root_list.root(object); root_list @@ -208,7 +208,7 @@ where T: DomObject, { fn clone(&self) -> DomRoot { - DomRoot::from_ref(&*self) + DomRoot::from_ref(self) } } @@ -244,7 +244,7 @@ impl<'a> ThreadLocalStackRoots<'a> { impl<'a> Drop for ThreadLocalStackRoots<'a> { fn drop(&mut self) { - STACK_ROOTS.with(|ref r| r.set(None)); + STACK_ROOTS.with(|r| r.set(None)); } } @@ -282,7 +282,7 @@ impl RootCollection { /// SM Callback that traces the rooted reflectors pub unsafe fn trace_roots(tracer: *mut JSTracer) { debug!("tracing stack roots"); - STACK_ROOTS.with(|ref collection| { + STACK_ROOTS.with(|collection| { let collection = &*(*collection.get().unwrap()).roots.get(); for root in collection { (**root).trace(tracer); diff --git a/components/script/dom/bindings/str.rs b/components/script/dom/bindings/str.rs index c7568f2c351..070c674d596 100644 --- a/components/script/dom/bindings/str.rs +++ b/components/script/dom/bindings/str.rs @@ -275,7 +275,7 @@ impl DOMString { '2' => State::HourLow03, _ => State::Error, }, - State::HourLow09 => next_state(c.is_digit(10), State::MinuteColon), + State::HourLow09 => next_state(c.is_ascii_digit(), State::MinuteColon), State::HourLow03 => next_state(c.is_digit(4), State::MinuteColon), // Step 2 ":" @@ -283,20 +283,20 @@ impl DOMString { // Step 3 "mm" State::MinuteHigh => next_state(c.is_digit(6), State::MinuteLow), - State::MinuteLow => next_state(c.is_digit(10), State::SecondColon), + State::MinuteLow => next_state(c.is_ascii_digit(), State::SecondColon), // Step 4.1 ":" State::SecondColon => next_state(c == ':', State::SecondHigh), // Step 4.2 "ss" State::SecondHigh => next_state(c.is_digit(6), State::SecondLow), - State::SecondLow => next_state(c.is_digit(10), State::MilliStop), + State::SecondLow => next_state(c.is_ascii_digit(), State::MilliStop), // Step 4.3.1 "." State::MilliStop => next_state(c == '.', State::MilliHigh), // Step 4.3.2 "SSS" - State::MilliHigh => next_state(c.is_digit(10), State::MilliMiddle), - State::MilliMiddle => next_state(c.is_digit(10), State::MilliLow), - State::MilliLow => next_state(c.is_digit(10), State::Done), + State::MilliHigh => next_state(c.is_ascii_digit(), State::MilliMiddle), + State::MilliMiddle => next_state(c.is_ascii_digit(), State::MilliLow), + State::MilliLow => next_state(c.is_ascii_digit(), State::Done), _ => State::Error, }