cargo fmt + cargo clippy

This commit is contained in:
Shawn Wallace 2025-01-09 00:08:07 -05:00
parent 47e7357eab
commit ba9c1a6a3e
4 changed files with 16 additions and 25 deletions

View file

@ -545,7 +545,7 @@ impl HandleEvent for Keyboard {
if let Some(data) = state
.objects
.get(key)
.map(|o| <_ as AsRef<SurfaceData>>::as_ref(o))
.map(<_ as AsRef<SurfaceData>>::as_ref)
{
state.last_kb_serial = Some(serial);
let output_name = data.get_output_name(state);
@ -564,7 +564,7 @@ impl HandleEvent for Keyboard {
if let Some(data) = state
.objects
.get(key)
.map(|o| <_ as AsRef<SurfaceData>>::as_ref(o))
.map(<_ as AsRef<SurfaceData>>::as_ref)
{
if state.to_focus.as_ref().map(|d| d.window) == Some(data.window.unwrap()) {
state.to_focus.take();
@ -741,7 +741,7 @@ impl Output {
state.connection.as_mut().unwrap(),
);
return true;
true
});
}
fn wl_event<C: XConnection>(

View file

@ -679,7 +679,7 @@ impl<C: XConnection> ServerState<C> {
return true;
};
!(win.mapped && !win.attrs.override_redirect)
!win.mapped || win.attrs.override_redirect
}
pub fn reconfigure_window(&mut self, event: x::ConfigureNotifyEvent) {

View file

@ -749,9 +749,9 @@ where
backend: &Backend,
msg: Message<ObjectId, std::os::fd::OwnedFd>,
) -> Option<Arc<dyn ObjectData>> {
fn obj_data<T: Proxy>() -> Arc<dyn ObjectData>
fn obj_data<T>() -> Arc<dyn ObjectData>
where
T: Send + Sync + 'static,
T: Proxy + Send + Sync + 'static,
T::Event: Send + Sync + std::fmt::Debug,
{
Arc::new(TestObjectData::<T>::default())
@ -1143,7 +1143,6 @@ fn window_group_properties() {
win,
super::WmHints {
window_group: Some(prop_win),
..Default::default()
},
);
f.satellite.map_window(win);
@ -1524,10 +1523,11 @@ fn ignore_toplevel_reconfigure() {
);
}
type EventMatcher<'a, Event> = Box<dyn FnMut(&Event) -> bool + 'a>;
#[track_caller]
fn events_check<'a, Event: std::fmt::Debug, const N: usize>(
fn events_check<Event: std::fmt::Debug, const N: usize>(
mut it: impl Iterator<Item = Event>,
mut matchers: [Box<dyn FnMut(&Event) -> bool + 'a>; N],
mut matchers: [EventMatcher<'_, Event>; N],
) {
for (idx, matcher) in matchers.iter_mut().enumerate() {
let item = it.next();
@ -1595,10 +1595,7 @@ fn tablet_smoke_test() {
events_check(
tab_events,
[
Box::new(|e| match e {
zwp_tablet_v2::Event::Name { name } if name == "tabby" => true,
_ => false,
}),
Box::new(|e| matches!(e, zwp_tablet_v2::Event::Name { name } if name == "tabby")),
Box::new(|e| matches!(e, zwp_tablet_v2::Event::Done)),
],
);
@ -1644,9 +1641,9 @@ fn tablet_smoke_test() {
events_check(
g_events,
[
Box::new(|e| match e {
zwp_tablet_pad_group_v2::Event::Buttons { buttons } if buttons.is_empty() => true,
_ => false,
Box::new(|e| {
matches!(e,
zwp_tablet_pad_group_v2::Event::Buttons { buttons } if buttons.is_empty())
}),
Box::new(|e| matches!(e, zwp_tablet_pad_group_v2::Event::Ring { .. })),
Box::new(|e| matches!(e, zwp_tablet_pad_group_v2::Event::Strip { .. })),