chore: address 1.79 clippy lints
This commit is contained in:
parent
3b4e064a07
commit
078b46720b
15 changed files with 30 additions and 30 deletions
|
|
@ -1,5 +1,3 @@
|
||||||
#![cfg(android_platform)]
|
|
||||||
|
|
||||||
use std::cell::Cell;
|
use std::cell::Cell;
|
||||||
use std::collections::VecDeque;
|
use std::collections::VecDeque;
|
||||||
use std::hash::Hash;
|
use std::hash::Hash;
|
||||||
|
|
|
||||||
|
|
@ -798,7 +798,7 @@ impl EventLoopWaker {
|
||||||
// future, but that gets changed to fire immediately in did_finish_launching
|
// future, but that gets changed to fire immediately in did_finish_launching
|
||||||
let timer = CFRunLoopTimerCreate(
|
let timer = CFRunLoopTimerCreate(
|
||||||
ptr::null_mut(),
|
ptr::null_mut(),
|
||||||
std::f64::MAX,
|
f64::MAX,
|
||||||
0.000_000_1,
|
0.000_000_1,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
|
|
@ -812,11 +812,11 @@ impl EventLoopWaker {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn stop(&mut self) {
|
fn stop(&mut self) {
|
||||||
unsafe { CFRunLoopTimerSetNextFireDate(self.timer, std::f64::MAX) }
|
unsafe { CFRunLoopTimerSetNextFireDate(self.timer, f64::MAX) }
|
||||||
}
|
}
|
||||||
|
|
||||||
fn start(&mut self) {
|
fn start(&mut self) {
|
||||||
unsafe { CFRunLoopTimerSetNextFireDate(self.timer, std::f64::MIN) }
|
unsafe { CFRunLoopTimerSetNextFireDate(self.timer, f64::MIN) }
|
||||||
}
|
}
|
||||||
|
|
||||||
fn start_at(&mut self, instant: Instant) {
|
fn start_at(&mut self, instant: Instant) {
|
||||||
|
|
|
||||||
|
|
@ -283,8 +283,7 @@ impl<T> EventLoopProxy<T> {
|
||||||
cancel: None,
|
cancel: None,
|
||||||
perform: event_loop_proxy_handler,
|
perform: event_loop_proxy_handler,
|
||||||
};
|
};
|
||||||
let source =
|
let source = CFRunLoopSourceCreate(ptr::null_mut(), CFIndex::MAX - 1, &mut context);
|
||||||
CFRunLoopSourceCreate(ptr::null_mut(), CFIndex::max_value() - 1, &mut context);
|
|
||||||
CFRunLoopAddSource(rl, source, kCFRunLoopCommonModes);
|
CFRunLoopAddSource(rl, source, kCFRunLoopCommonModes);
|
||||||
CFRunLoopWakeUp(rl);
|
CFRunLoopWakeUp(rl);
|
||||||
|
|
||||||
|
|
@ -367,7 +366,7 @@ fn setup_control_flow_observers() {
|
||||||
ptr::null_mut(),
|
ptr::null_mut(),
|
||||||
kCFRunLoopAfterWaiting,
|
kCFRunLoopAfterWaiting,
|
||||||
1, // repeat = true
|
1, // repeat = true
|
||||||
CFIndex::min_value(),
|
CFIndex::MIN,
|
||||||
control_flow_begin_handler,
|
control_flow_begin_handler,
|
||||||
ptr::null_mut(),
|
ptr::null_mut(),
|
||||||
);
|
);
|
||||||
|
|
@ -387,7 +386,7 @@ fn setup_control_flow_observers() {
|
||||||
ptr::null_mut(),
|
ptr::null_mut(),
|
||||||
kCFRunLoopExit | kCFRunLoopBeforeWaiting,
|
kCFRunLoopExit | kCFRunLoopBeforeWaiting,
|
||||||
1, // repeat = true
|
1, // repeat = true
|
||||||
CFIndex::max_value(),
|
CFIndex::MAX,
|
||||||
control_flow_end_handler,
|
control_flow_end_handler,
|
||||||
ptr::null_mut(),
|
ptr::null_mut(),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
#![cfg(ios_platform)]
|
|
||||||
#![allow(clippy::let_unit_value)]
|
#![allow(clippy::let_unit_value)]
|
||||||
|
|
||||||
mod app_delegate;
|
mod app_delegate;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
#![cfg(wayland_platform)]
|
|
||||||
|
|
||||||
//! Winit's Wayland backend.
|
//! Winit's Wayland backend.
|
||||||
|
|
||||||
use std::fmt::Display;
|
use std::fmt::Display;
|
||||||
|
|
|
||||||
|
|
@ -434,7 +434,7 @@ impl EventProcessor {
|
||||||
let flags = xev.data.get_long(1);
|
let flags = xev.data.get_long(1);
|
||||||
let version = flags >> 24;
|
let version = flags >> 24;
|
||||||
self.dnd.version = Some(version);
|
self.dnd.version = Some(version);
|
||||||
let has_more_types = flags - (flags & (c_long::max_value() - 1)) == 1;
|
let has_more_types = flags - (flags & (c_long::MAX - 1)) == 1;
|
||||||
if !has_more_types {
|
if !has_more_types {
|
||||||
let type_list = vec![
|
let type_list = vec![
|
||||||
xev.data.get_long(2) as xproto::Atom,
|
xev.data.get_long(2) as xproto::Atom,
|
||||||
|
|
|
||||||
|
|
@ -158,7 +158,9 @@ struct PreeditCallbacks {
|
||||||
impl PreeditCallbacks {
|
impl PreeditCallbacks {
|
||||||
pub fn new(client_data: ffi::XPointer) -> PreeditCallbacks {
|
pub fn new(client_data: ffi::XPointer) -> PreeditCallbacks {
|
||||||
let start_callback = create_xim_callback(client_data, unsafe {
|
let start_callback = create_xim_callback(client_data, unsafe {
|
||||||
mem::transmute(preedit_start_callback as usize)
|
mem::transmute::<usize, unsafe extern "C" fn(ffi::XIM, *mut i8, *mut i8)>(
|
||||||
|
preedit_start_callback as usize,
|
||||||
|
)
|
||||||
});
|
});
|
||||||
let done_callback = create_xim_callback(client_data, preedit_done_callback);
|
let done_callback = create_xim_callback(client_data, preedit_done_callback);
|
||||||
let caret_callback = create_xim_callback(client_data, preedit_caret_callback);
|
let caret_callback = create_xim_callback(client_data, preedit_caret_callback);
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
#![cfg(x11_platform)]
|
|
||||||
|
|
||||||
use std::cell::{Cell, RefCell};
|
use std::cell::{Cell, RefCell};
|
||||||
use std::collections::{HashMap, HashSet, VecDeque};
|
use std::collections::{HashMap, HashSet, VecDeque};
|
||||||
use std::ffi::CStr;
|
use std::ffi::CStr;
|
||||||
|
|
|
||||||
|
|
@ -492,8 +492,7 @@ impl<T> EventLoopProxy<T> {
|
||||||
cancel: None,
|
cancel: None,
|
||||||
perform: event_loop_proxy_handler,
|
perform: event_loop_proxy_handler,
|
||||||
};
|
};
|
||||||
let source =
|
let source = CFRunLoopSourceCreate(ptr::null_mut(), CFIndex::MAX - 1, &mut context);
|
||||||
CFRunLoopSourceCreate(ptr::null_mut(), CFIndex::max_value() - 1, &mut context);
|
|
||||||
CFRunLoopAddSource(rl, source, kCFRunLoopCommonModes);
|
CFRunLoopAddSource(rl, source, kCFRunLoopCommonModes);
|
||||||
CFRunLoopWakeUp(rl);
|
CFRunLoopWakeUp(rl);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -214,13 +214,13 @@ pub fn setup_control_flow_observers(mtm: MainThreadMarker, panic_info: Weak<Pani
|
||||||
};
|
};
|
||||||
run_loop.add_observer(
|
run_loop.add_observer(
|
||||||
kCFRunLoopAfterWaiting,
|
kCFRunLoopAfterWaiting,
|
||||||
CFIndex::min_value(),
|
CFIndex::MIN,
|
||||||
control_flow_begin_handler,
|
control_flow_begin_handler,
|
||||||
&mut context as *mut _,
|
&mut context as *mut _,
|
||||||
);
|
);
|
||||||
run_loop.add_observer(
|
run_loop.add_observer(
|
||||||
kCFRunLoopExit | kCFRunLoopBeforeWaiting,
|
kCFRunLoopExit | kCFRunLoopBeforeWaiting,
|
||||||
CFIndex::max_value(),
|
CFIndex::MAX,
|
||||||
control_flow_end_handler,
|
control_flow_end_handler,
|
||||||
&mut context as *mut _,
|
&mut context as *mut _,
|
||||||
);
|
);
|
||||||
|
|
@ -260,7 +260,7 @@ impl EventLoopWaker {
|
||||||
// future, but that gets changed to fire immediately in did_finish_launching
|
// future, but that gets changed to fire immediately in did_finish_launching
|
||||||
let timer = CFRunLoopTimerCreate(
|
let timer = CFRunLoopTimerCreate(
|
||||||
ptr::null_mut(),
|
ptr::null_mut(),
|
||||||
std::f64::MAX,
|
f64::MAX,
|
||||||
0.000_000_1,
|
0.000_000_1,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
|
|
@ -275,14 +275,14 @@ impl EventLoopWaker {
|
||||||
pub fn stop(&mut self) {
|
pub fn stop(&mut self) {
|
||||||
if self.next_fire_date.is_some() {
|
if self.next_fire_date.is_some() {
|
||||||
self.next_fire_date = None;
|
self.next_fire_date = None;
|
||||||
unsafe { CFRunLoopTimerSetNextFireDate(self.timer, std::f64::MAX) }
|
unsafe { CFRunLoopTimerSetNextFireDate(self.timer, f64::MAX) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn start(&mut self) {
|
pub fn start(&mut self) {
|
||||||
if self.next_fire_date != Some(self.start_instant) {
|
if self.next_fire_date != Some(self.start_instant) {
|
||||||
self.next_fire_date = Some(self.start_instant);
|
self.next_fire_date = Some(self.start_instant);
|
||||||
unsafe { CFRunLoopTimerSetNextFireDate(self.timer, std::f64::MIN) }
|
unsafe { CFRunLoopTimerSetNextFireDate(self.timer, f64::MIN) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -920,8 +920,8 @@ impl WindowDelegate {
|
||||||
|
|
||||||
pub fn set_max_inner_size(&self, dimensions: Option<Size>) {
|
pub fn set_max_inner_size(&self, dimensions: Option<Size>) {
|
||||||
let dimensions = dimensions.unwrap_or(Size::Logical(LogicalSize {
|
let dimensions = dimensions.unwrap_or(Size::Logical(LogicalSize {
|
||||||
width: std::f32::MAX as f64,
|
width: f32::MAX as f64,
|
||||||
height: std::f32::MAX as f64,
|
height: f32::MAX as f64,
|
||||||
}));
|
}));
|
||||||
let scale_factor = self.scale_factor();
|
let scale_factor = self.scale_factor();
|
||||||
let max_size = dimensions.to_logical::<CGFloat>(scale_factor);
|
let max_size = dimensions.to_logical::<CGFloat>(scale_factor);
|
||||||
|
|
|
||||||
|
|
@ -103,7 +103,7 @@ pub struct WindowId {
|
||||||
|
|
||||||
impl WindowId {
|
impl WindowId {
|
||||||
pub const fn dummy() -> Self {
|
pub const fn dummy() -> Self {
|
||||||
WindowId { fd: u64::max_value() }
|
WindowId { fd: u64::MAX }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,12 @@ impl<T> Dispatcher<T> {
|
||||||
// SAFETY: The `transmute` is necessary because `Closure` requires `'static`. This is
|
// SAFETY: The `transmute` is necessary because `Closure` requires `'static`. This is
|
||||||
// safe because this function won't return until `f` has finished executing. See
|
// safe because this function won't return until `f` has finished executing. See
|
||||||
// `Self::new()`.
|
// `Self::new()`.
|
||||||
let closure = Closure(unsafe { std::mem::transmute(closure) });
|
let closure = Closure(unsafe {
|
||||||
|
std::mem::transmute::<
|
||||||
|
Box<dyn FnOnce(&T) + Send>,
|
||||||
|
Box<dyn FnOnce(&T) + Send + 'static>,
|
||||||
|
>(closure)
|
||||||
|
});
|
||||||
|
|
||||||
self.0.send(closure);
|
self.0.send(closure);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,11 @@ impl<T> EventLoop<T> {
|
||||||
// SAFETY: The `transmute` is necessary because `run()` requires `'static`. This is safe
|
// SAFETY: The `transmute` is necessary because `run()` requires `'static`. This is safe
|
||||||
// because this function will never return and all resources not cleaned up by the point we
|
// because this function will never return and all resources not cleaned up by the point we
|
||||||
// `throw` will leak, making this actually `'static`.
|
// `throw` will leak, making this actually `'static`.
|
||||||
let handler = unsafe { std::mem::transmute(handler) };
|
let handler = unsafe {
|
||||||
|
std::mem::transmute::<Box<dyn FnMut(Event<()>)>, Box<dyn FnMut(Event<()>) + 'static>>(
|
||||||
|
handler,
|
||||||
|
)
|
||||||
|
};
|
||||||
self.elw.p.run(handler, false);
|
self.elw.p.run(handler, false);
|
||||||
|
|
||||||
// Throw an exception to break out of Rust execution and use unreachable to tell the
|
// Throw an exception to break out of Rust execution and use unreachable to tell the
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
#![cfg(windows_platform)]
|
|
||||||
|
|
||||||
use smol_str::SmolStr;
|
use smol_str::SmolStr;
|
||||||
use windows_sys::Win32::Foundation::{HANDLE, HWND};
|
use windows_sys::Win32::Foundation::{HANDLE, HWND};
|
||||||
use windows_sys::Win32::UI::WindowsAndMessaging::{HMENU, WINDOW_LONG_PTR_INDEX};
|
use windows_sys::Win32::UI::WindowsAndMessaging::{HMENU, WINDOW_LONG_PTR_INDEX};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue