Migrate to 2018 edition. (#924)

* Migrate to 2018 edition.

* Use impl Iterator at one site.

* Fix more rust 2018 idioms.
This commit is contained in:
CrLF0710 2019-06-18 02:27:00 +08:00 committed by Osspial
parent 2e0bbc091f
commit f879bca21c
71 changed files with 411 additions and 436 deletions

View file

@ -1,13 +1,13 @@
use std::sync::{Arc, Mutex};
use event::{TouchPhase, WindowEvent};
use crate::event::{TouchPhase, WindowEvent};
use super::{DeviceId, WindowId};
use super::event_loop::WindowEventsSink;
use super::window::WindowStore;
use sctk::reexports::client::protocol::wl_touch::{Event as TouchEvent, WlTouch};
use sctk::reexports::client::protocol::wl_seat;
use smithay_client_toolkit::reexports::client::protocol::wl_touch::{Event as TouchEvent, WlTouch};
use smithay_client_toolkit::reexports::client::protocol::wl_seat;
struct TouchPoint {
wid: WindowId,
@ -32,8 +32,8 @@ pub(crate) fn implement_touch(
let wid = store.find_wid(&surface);
if let Some(wid) = wid {
sink.send_event(
WindowEvent::Touch(::event::Touch {
device_id: ::event::DeviceId(::platform_impl::DeviceId::Wayland(DeviceId)),
WindowEvent::Touch(crate::event::Touch {
device_id: crate::event::DeviceId(crate::platform_impl::DeviceId::Wayland(DeviceId)),
phase: TouchPhase::Started,
location: (x, y).into(),
id: id as u64,
@ -52,8 +52,8 @@ pub(crate) fn implement_touch(
if let Some(idx) = idx {
let pt = pending_ids.remove(idx);
sink.send_event(
WindowEvent::Touch(::event::Touch {
device_id: ::event::DeviceId(::platform_impl::DeviceId::Wayland(DeviceId)),
WindowEvent::Touch(crate::event::Touch {
device_id: crate::event::DeviceId(crate::platform_impl::DeviceId::Wayland(DeviceId)),
phase: TouchPhase::Ended,
location: pt.location.into(),
id: id as u64,
@ -67,8 +67,8 @@ pub(crate) fn implement_touch(
if let Some(pt) = pt {
pt.location = (x, y);
sink.send_event(
WindowEvent::Touch(::event::Touch {
device_id: ::event::DeviceId(::platform_impl::DeviceId::Wayland(DeviceId)),
WindowEvent::Touch(crate::event::Touch {
device_id: crate::event::DeviceId(crate::platform_impl::DeviceId::Wayland(DeviceId)),
phase: TouchPhase::Moved,
location: (x, y).into(),
id: id as u64,
@ -80,8 +80,8 @@ pub(crate) fn implement_touch(
TouchEvent::Frame => (),
TouchEvent::Cancel => for pt in pending_ids.drain(..) {
sink.send_event(
WindowEvent::Touch(::event::Touch {
device_id: ::event::DeviceId(::platform_impl::DeviceId::Wayland(DeviceId)),
WindowEvent::Touch(crate::event::Touch {
device_id: crate::event::DeviceId(crate::platform_impl::DeviceId::Wayland(DeviceId)),
phase: TouchPhase::Cancelled,
location: pt.location.into(),
id: pt.id as u64,