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,18 +1,18 @@
#![cfg(any(target_os = "android"))]
use std::os::raw::c_void;
use EventLoop;
use Window;
use WindowBuilder;
use crate::EventLoop;
use crate::Window;
use crate::WindowBuilder;
/// Additional methods on `EventLoop` that are specific to Android.
pub trait EventLoopExtAndroid {
/// Makes it possible for glutin to register a callback when a suspend event happens on Android
fn set_suspend_callback(&self, cb: Option<Box<Fn(bool) -> ()>>);
fn set_suspend_callback(&self, cb: Option<Box<dyn Fn(bool) -> ()>>);
}
impl EventLoopExtAndroid for EventLoop {
fn set_suspend_callback(&self, cb: Option<Box<Fn(bool) -> ()>>) {
fn set_suspend_callback(&self, cb: Option<Box<dyn Fn(bool) -> ()>>) {
self.event_loop.set_suspend_callback(cb);
}
}

View file

@ -4,8 +4,8 @@
target_os = "linux", target_os = "dragonfly", target_os = "freebsd", target_os = "netbsd", target_os = "openbsd"
))]
use event::Event;
use event_loop::{EventLoop, EventLoopWindowTarget, ControlFlow};
use crate::event::Event;
use crate::event_loop::{EventLoop, EventLoopWindowTarget, ControlFlow};
/// Additional methods on `EventLoop` that are specific to desktop platforms.
pub trait EventLoopExtDesktop {

View file

@ -2,9 +2,9 @@
use std::os::raw::c_void;
use event_loop::EventLoop;
use monitor::MonitorHandle;
use window::{Window, WindowBuilder};
use crate::event_loop::EventLoop;
use crate::monitor::MonitorHandle;
use crate::window::{Window, WindowBuilder};
/// Additional methods on `EventLoop` that are specific to iOS.
pub trait EventLoopExtIOS {

View file

@ -4,26 +4,26 @@ use std::os::raw;
use std::ptr;
use std::sync::Arc;
use sctk::window::{ButtonState, Theme};
use smithay_client_toolkit::window::{ButtonState, Theme};
use dpi::LogicalSize;
use event_loop::EventLoop;
use monitor::MonitorHandle;
use window::{Window, WindowBuilder};
use crate::dpi::LogicalSize;
use crate::event_loop::EventLoop;
use crate::monitor::MonitorHandle;
use crate::window::{Window, WindowBuilder};
use platform_impl::{
use crate::platform_impl::{
EventLoop as LinuxEventLoop,
Window as LinuxWindow,
};
use platform_impl::x11::XConnection;
use platform_impl::x11::ffi::XVisualInfo;
use crate::platform_impl::x11::XConnection;
use crate::platform_impl::x11::ffi::XVisualInfo;
// TODO: stupid hack so that glutin can do its work
#[doc(hidden)]
pub use platform_impl::x11;
pub use crate::platform_impl::x11;
pub use platform_impl::XNotSupported;
pub use platform_impl::x11::util::WindowType as XWindowType;
pub use crate::platform_impl::XNotSupported;
pub use crate::platform_impl::x11::util::WindowType as XWindowType;
/// Theme for wayland client side decorations
///

View file

@ -5,11 +5,11 @@ use std::os::raw::c_void;
use libc;
use winapi::shared::windef::HWND;
use event::DeviceId;
use monitor::MonitorHandle;
use event_loop::EventLoop;
use window::{Icon, Window, WindowBuilder};
use platform_impl::EventLoop as WindowsEventLoop;
use crate::event::DeviceId;
use crate::monitor::MonitorHandle;
use crate::event_loop::EventLoop;
use crate::window::{Icon, Window, WindowBuilder};
use crate::platform_impl::EventLoop as WindowsEventLoop;
/// Additional methods on `EventLoop` that are specific to Windows.
pub trait EventLoopExtWindows {