Skip to content

Commit 74116c0

Browse files
committed
fix clippy and typo
1 parent 0caa552 commit 74116c0

7 files changed

Lines changed: 13 additions & 21 deletions

File tree

typos.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,8 @@ XF86_Calculater = "XF86_Calculater" # From xkbcommon_dl::keysyms::XF86_Calculate
66
ptd = "ptd" # From windows_sys::Win32::System::Com::FORMATETC { ptd, ..}
77
requestor = "requestor" # From x11_dl::xlib::XSelectionEvent { requestor ..}
88

9+
[default.extend-words]
10+
constrait = "constrait" # From winit-wayland/popup.rs constrait_adjustment.
11+
912
[files]
1013
extend-exclude = ["*.drawio"]

winit-wayland/src/event_loop/mod.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ impl EventLoop {
326326
// We don't need to check here if it should be closed, because if the parent should
327327
// be closed all children must be closed as well
328328
let children =
329-
state.windows.get_mut().get(&window_id).unwrap().lock().unwrap().children().clone();
329+
state.windows.get_mut().get(window_id).unwrap().lock().unwrap().children().clone();
330330
// First all children and then all subchildren
331331
out.extend(&children);
332332
for child in children.clone() {
@@ -488,9 +488,10 @@ impl EventLoop {
488488
let parent =
489489
state.windows.get_mut().get_mut(&w).unwrap().lock().unwrap().parent();
490490

491-
parent
492-
.and_then(|p| state.windows.get_mut().get_mut(&p))
493-
.map(|p| p.lock().unwrap().remove_child(&w));
491+
if let Some(p) = parent.and_then(|p| state.windows.get_mut().get_mut(&p)) {
492+
p.lock().unwrap().remove_child(&w)
493+
}
494+
494495
let window_requests = state.window_requests.get_mut();
495496
window_requests.get(&w).unwrap().take_closed();
496497
mem::drop(window_requests.remove(&w));

winit-wayland/src/popup.rs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,11 @@ use std::sync::{Arc, Mutex, Weak};
55
use dpi::{LogicalPosition, PhysicalInsets, PhysicalPosition, PhysicalSize, Position, Size};
66
use rwh_06::RawWindowHandle;
77
use sctk::compositor::SurfaceData;
8-
use sctk::reexports::client::protocol::wl_surface::WlSurface;
98
use sctk::shell::WaylandSurface;
109
use sctk::shell::xdg::popup::Popup as SctkPopup;
1110
use sctk::shell::xdg::{XdgPositioner, XdgSurface};
1211
use wayland_client::Proxy;
1312
use wayland_client::protocol::wl_display::WlDisplay;
14-
use wayland_protocols::xdg::shell::client::xdg_positioner::{
15-
Anchor, ConstraintAdjustment, Gravity,
16-
};
1713
use winit_core::cursor::Cursor;
1814
use winit_core::error::{NotSupportedError, RequestError};
1915
use winit_core::event::{Ime, WindowEvent};
@@ -122,7 +118,6 @@ impl Popup {
122118
size.to_logical(scale_factor).width,
123119
size.to_logical(scale_factor).height,
124120
);
125-
positioner.set_constraint_adjustment(ConstraintAdjustment::all());
126121

127122
let parent_surface = parent_window_state.window.xdg_surface();
128123
let surface = state.compositor_state.create_surface(&queue_handle);
@@ -296,7 +291,7 @@ impl CoreWindow for Popup {
296291
}
297292

298293
fn request_surface_size(&self, size: Size) -> Option<PhysicalSize<u32>> {
299-
let Some(s) = self.popup_state.upgrade() else { return None };
294+
let s = self.popup_state.upgrade()?;
300295
let mut popup_state = s.lock().unwrap();
301296
popup_state.request_surface_size(size);
302297
self.request_redraw();
@@ -335,7 +330,7 @@ impl CoreWindow for Popup {
335330
}
336331

337332
fn surface_resize_increments(&self) -> Option<PhysicalSize<u32>> {
338-
let Some(s) = self.popup_state.upgrade() else { return None };
333+
let s = self.popup_state.upgrade()?;
339334
let popup_state = s.lock().unwrap();
340335
let scale_factor = popup_state.scale_factor();
341336
popup_state
@@ -462,7 +457,7 @@ impl CoreWindow for Popup {
462457

463458
#[inline]
464459
fn ime_capabilities(&self) -> Option<ImeCapabilities> {
465-
let Some(s) = self.popup_state.upgrade() else { return None };
460+
let s = self.popup_state.upgrade()?;
466461
s.lock().unwrap().ime_allowed()
467462
}
468463

winit-wayland/src/seat/keyboard/mod.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
//! The keyboard input handling.
22
33
use std::sync::Mutex;
4-
use std::sync::atomic::Ordering;
54
use std::time::Duration;
65

76
use calloop::timer::{TimeoutAction, Timer};
@@ -232,12 +231,7 @@ impl Dispatch<WlKeyboard, KeyboardData, WinitState> for WinitState {
232231
}
233232
},
234233
WlKeyboardEvent::Modifiers {
235-
serial,
236-
mods_depressed,
237-
mods_latched,
238-
mods_locked,
239-
group,
240-
..
234+
mods_depressed, mods_latched, mods_locked, group, ..
241235
} => {
242236
let xkb_context = &mut keyboard_state.xkb_context;
243237
let xkb_state = match xkb_context.state_mut() {

winit-wayland/src/seat/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
33
use std::cell::Cell;
44
use std::sync::Arc;
5-
use std::sync::atomic::{AtomicU32, Ordering};
65

76
use foldhash::HashMap;
87
use sctk::reexports::client::backend::ObjectId;

winit-wayland/src/seat/pointer/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
//! The pointer events.
22
33
use std::ops::Deref;
4-
use std::sync::atomic::Ordering;
54
use std::sync::{Arc, Mutex};
65
use std::time::Duration;
76

winit-wayland/src/window/state.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ pub struct WindowState {
214214

215215
impl WindowState {
216216
/// Create new window state.
217+
#[allow(clippy::too_many_arguments)]
217218
pub fn new(
218219
active_event_loop: &ActiveEventLoop,
219220
winit_state: &WinitState,

0 commit comments

Comments
 (0)