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:
parent
2e0bbc091f
commit
f879bca21c
71 changed files with 411 additions and 436 deletions
|
|
@ -13,9 +13,9 @@ use std::{fmt, error};
|
|||
use std::time::Instant;
|
||||
use std::ops::Deref;
|
||||
|
||||
use platform_impl;
|
||||
use event::Event;
|
||||
use monitor::{AvailableMonitorsIter, MonitorHandle};
|
||||
use crate::platform_impl;
|
||||
use crate::event::Event;
|
||||
use crate::monitor::{AvailableMonitorsIter, MonitorHandle};
|
||||
|
||||
/// Provides a way to retrieve events from the system and from the windows that were registered to
|
||||
/// the events loop.
|
||||
|
|
@ -46,13 +46,13 @@ pub struct EventLoopWindowTarget<T: 'static> {
|
|||
}
|
||||
|
||||
impl<T> fmt::Debug for EventLoop<T> {
|
||||
fn fmt(&self, fmtr: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, fmtr: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
fmtr.pad("EventLoop { .. }")
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> fmt::Debug for EventLoopWindowTarget<T> {
|
||||
fn fmt(&self, fmtr: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, fmtr: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
fmtr.pad("EventLoopWindowTarget { .. }")
|
||||
}
|
||||
}
|
||||
|
|
@ -146,10 +146,8 @@ impl<T> EventLoop<T> {
|
|||
}
|
||||
|
||||
/// Returns the list of all the monitors available on the system.
|
||||
///
|
||||
// Note: should be replaced with `-> impl Iterator` once stable.
|
||||
#[inline]
|
||||
pub fn available_monitors(&self) -> AvailableMonitorsIter {
|
||||
pub fn available_monitors(&self) -> impl Iterator<Item = MonitorHandle> {
|
||||
let data = self.event_loop.available_monitors();
|
||||
AvailableMonitorsIter{ data: data.into_iter() }
|
||||
}
|
||||
|
|
@ -186,7 +184,7 @@ impl<T: 'static> EventLoopProxy<T> {
|
|||
}
|
||||
|
||||
impl<T: 'static> fmt::Debug for EventLoopProxy<T> {
|
||||
fn fmt(&self, fmtr: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, fmtr: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
fmtr.pad("EventLoopProxy { .. }")
|
||||
}
|
||||
}
|
||||
|
|
@ -197,7 +195,7 @@ impl<T: 'static> fmt::Debug for EventLoopProxy<T> {
|
|||
pub struct EventLoopClosed;
|
||||
|
||||
impl fmt::Display for EventLoopClosed {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
write!(f, "{}", error::Error::description(self))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue