mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
clippy: Fix some warnings in components/script/timers.rs
(#31878)
* Fixed some clippy warnings in components/script/timers.rs * Formatted changes in components/script/timers.rs * Updated changes in components/script/timers.rs * Updated Default implementation of JsTimers in components/script/timers.rs * UPDATED DEFAULT METHOD IMPLEMENTATION OF JsTimers in components/script/timers.rs
This commit is contained in:
parent
9b50a6be77
commit
29f796a1de
1 changed files with 7 additions and 5 deletions
|
@ -124,14 +124,14 @@ impl PartialOrd for OneshotTimer {
|
||||||
impl Eq for OneshotTimer {}
|
impl Eq for OneshotTimer {}
|
||||||
impl PartialEq for OneshotTimer {
|
impl PartialEq for OneshotTimer {
|
||||||
fn eq(&self, other: &OneshotTimer) -> bool {
|
fn eq(&self, other: &OneshotTimer) -> bool {
|
||||||
self as *const OneshotTimer == other as *const OneshotTimer
|
std::ptr::eq(self, other)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl OneshotTimers {
|
impl OneshotTimers {
|
||||||
pub fn new(scheduler_chan: IpcSender<TimerSchedulerMsg>) -> OneshotTimers {
|
pub fn new(scheduler_chan: IpcSender<TimerSchedulerMsg>) -> OneshotTimers {
|
||||||
OneshotTimers {
|
OneshotTimers {
|
||||||
js_timers: JsTimers::new(),
|
js_timers: JsTimers::default(),
|
||||||
timer_event_chan: DomRefCell::new(None),
|
timer_event_chan: DomRefCell::new(None),
|
||||||
scheduler_chan,
|
scheduler_chan,
|
||||||
next_timer_handle: Cell::new(OneshotTimerHandle(1)),
|
next_timer_handle: Cell::new(OneshotTimerHandle(1)),
|
||||||
|
@ -194,7 +194,7 @@ impl OneshotTimers {
|
||||||
fn is_next_timer(&self, handle: OneshotTimerHandle) -> bool {
|
fn is_next_timer(&self, handle: OneshotTimerHandle) -> bool {
|
||||||
match self.timers.borrow().last() {
|
match self.timers.borrow().last() {
|
||||||
None => false,
|
None => false,
|
||||||
Some(ref max_timer) => max_timer.handle == handle,
|
Some(max_timer) => max_timer.handle == handle,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -418,8 +418,8 @@ enum InternalTimerCallback {
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl JsTimers {
|
impl Default for JsTimers {
|
||||||
pub fn new() -> JsTimers {
|
fn default() -> Self {
|
||||||
JsTimers {
|
JsTimers {
|
||||||
next_timer_handle: Cell::new(JsTimerHandle(1)),
|
next_timer_handle: Cell::new(JsTimerHandle(1)),
|
||||||
active_timers: DomRefCell::new(HashMap::new()),
|
active_timers: DomRefCell::new(HashMap::new()),
|
||||||
|
@ -427,7 +427,9 @@ impl JsTimers {
|
||||||
min_duration: Cell::new(None),
|
min_duration: Cell::new(None),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl JsTimers {
|
||||||
// see https://html.spec.whatwg.org/multipage/#timer-initialisation-steps
|
// see https://html.spec.whatwg.org/multipage/#timer-initialisation-steps
|
||||||
pub fn set_timeout_or_interval(
|
pub fn set_timeout_or_interval(
|
||||||
&self,
|
&self,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue