mirror of
https://github.com/servo/servo.git
synced 2025-08-07 14:35:33 +01:00
Fix a bunch of clippy lints
This commit is contained in:
parent
b1ca3d1cdf
commit
6b215f38ee
58 changed files with 281 additions and 356 deletions
|
@ -512,14 +512,12 @@ impl<Window: WindowMethods> IOCompositor<Window> {
|
|||
|
||||
(Msg::ScrollTimeout(timestamp), ShutdownState::NotShuttingDown) => {
|
||||
debug!("scroll timeout, drawing unpainted content!");
|
||||
match self.composition_request {
|
||||
CompositionRequest::CompositeOnScrollTimeout(this_timestamp) => {
|
||||
if timestamp == this_timestamp {
|
||||
self.composition_request = CompositionRequest::CompositeNow(
|
||||
CompositingReason::HitScrollTimeout)
|
||||
}
|
||||
if let CompositionRequest::CompositeOnScrollTimeout(this_timestamp) =
|
||||
self.composition_request {
|
||||
if timestamp == this_timestamp {
|
||||
self.composition_request = CompositionRequest::CompositeNow(
|
||||
CompositingReason::HitScrollTimeout)
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -644,7 +642,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
|
|||
if !self.pipeline_details.contains_key(&pipeline_id) {
|
||||
self.pipeline_details.insert(pipeline_id, PipelineDetails::new());
|
||||
}
|
||||
return self.pipeline_details.get_mut(&pipeline_id).unwrap();
|
||||
self.pipeline_details.get_mut(&pipeline_id).unwrap()
|
||||
}
|
||||
|
||||
pub fn pipeline(&self, pipeline_id: PipelineId) -> Option<&CompositionPipeline> {
|
||||
|
@ -730,7 +728,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
|
|||
root_layer.bounds.borrow_mut().size = Size2D::from_untyped(&frame_size);
|
||||
}
|
||||
|
||||
return root_layer;
|
||||
root_layer
|
||||
}
|
||||
|
||||
fn create_pipeline_details_for_frame_tree(&mut self, frame_tree: &SendableFrameTree) {
|
||||
|
@ -1223,11 +1221,8 @@ impl<Window: WindowMethods> IOCompositor<Window> {
|
|||
result.layer.send_event(self, TouchEvent(TouchEventType::Up, identifier,
|
||||
result.point.to_untyped()));
|
||||
}
|
||||
match self.touch_handler.on_touch_up(identifier, point) {
|
||||
TouchAction::Click => {
|
||||
self.simulate_mouse_click(point);
|
||||
}
|
||||
_ => {}
|
||||
if let TouchAction::Click = self.touch_handler.on_touch_up(identifier, point) {
|
||||
self.simulate_mouse_click(point);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1882,7 +1877,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
|
|||
return None;
|
||||
}
|
||||
|
||||
return Some(HitTestResult { layer: layer, point: point_in_parent_layer });
|
||||
Some(HitTestResult { layer: layer, point: point_in_parent_layer })
|
||||
}
|
||||
|
||||
fn find_topmost_layer_at_point(&self,
|
||||
|
@ -2001,7 +1996,7 @@ fn find_layer_with_pipeline_and_layer_id_for_layer(layer: Rc<Layer<CompositorDat
|
|||
}
|
||||
}
|
||||
|
||||
return None;
|
||||
None
|
||||
}
|
||||
|
||||
impl<Window> CompositorEventListener for IOCompositor<Window> where Window: WindowMethods {
|
||||
|
|
|
@ -359,9 +359,9 @@ impl CompositorLayer for Layer<CompositorData> {
|
|||
}
|
||||
|
||||
if result {
|
||||
return ScrollEventResult::ScrollPositionChanged;
|
||||
ScrollEventResult::ScrollPositionChanged
|
||||
} else {
|
||||
return ScrollEventResult::ScrollPositionUnchanged;
|
||||
ScrollEventResult::ScrollPositionUnchanged
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -414,7 +414,7 @@ impl CompositorLayer for Layer<CompositorData> {
|
|||
result |= child.scroll_layer_and_all_child_layers(offset_for_children);
|
||||
}
|
||||
|
||||
return result;
|
||||
result
|
||||
}
|
||||
|
||||
fn wants_scroll_events(&self) -> WantsScrollEventsFlag {
|
||||
|
|
|
@ -155,14 +155,14 @@ impl TimerScheduler {
|
|||
|
||||
let ret = sel.wait();
|
||||
if ret == scheduler_handle.id() {
|
||||
port.recv().ok().map(|req| Task::HandleRequest(req))
|
||||
port.recv().ok().map(Task::HandleRequest)
|
||||
} else if ret == timer_handle.id() {
|
||||
timer_port.recv().ok().map(|_| Task::DispatchDueEvents)
|
||||
} else {
|
||||
panic!("unexpected select result!")
|
||||
}
|
||||
} else {
|
||||
port.recv().ok().map(|req| Task::HandleRequest(req))
|
||||
port.recv().ok().map(Task::HandleRequest)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -172,8 +172,7 @@ impl TimerScheduler {
|
|||
let schedule_for = precise_time_ns() + duration_ns;
|
||||
|
||||
let previously_earliest = self.scheduled_events.borrow().peek()
|
||||
.map(|scheduled| scheduled.for_time)
|
||||
.unwrap_or(Length::new(u64::max_value()));
|
||||
.map_or(Length::new(u64::max_value()), |scheduled| scheduled.for_time);
|
||||
|
||||
self.scheduled_events.borrow_mut().push(ScheduledEvent {
|
||||
request: request,
|
||||
|
|
|
@ -203,16 +203,15 @@ impl TouchHandler {
|
|||
}
|
||||
|
||||
pub fn on_event_processed(&mut self, result: EventResult) {
|
||||
match self.state {
|
||||
WaitingForScript => self.state = match result {
|
||||
if let WaitingForScript = self.state {
|
||||
self.state = match result {
|
||||
EventResult::DefaultPrevented => DefaultPrevented,
|
||||
EventResult::DefaultAllowed => match self.touch_count() {
|
||||
1 => Touching,
|
||||
2 => Pinching,
|
||||
_ => MultiTouch,
|
||||
}
|
||||
},
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue