From e4bb8c3f9dd2c70b8efdcb35b6a2d6aa30d5414e Mon Sep 17 00:00:00 2001 From: Shawn Wallace Date: Sat, 12 Jul 2025 12:29:33 -0400 Subject: [PATCH] cargo clippy everywhere --- .github/workflows/ci.yml | 2 +- Cargo.toml | 5 +++-- src/server/mod.rs | 3 +-- src/xstate/mod.rs | 10 +++++----- src/xstate/selection.rs | 4 ++-- testwl/Cargo.toml | 3 +++ testwl/src/lib.rs | 6 +++--- 7 files changed, 18 insertions(+), 15 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 854cdf6..0a35426 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -81,4 +81,4 @@ jobs: - name: Format check run: cargo fmt --check - name: Clippy - run: cargo clippy + run: cargo clippy --workspace --all-targets diff --git a/Cargo.toml b/Cargo.toml index 7276eb0..6a875f8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ [workspace] -members = ["macros"] +members = ["macros", "testwl"] [workspace.dependencies] wayland-client = "0.31.2" @@ -16,7 +16,8 @@ name = "xwayland-satellite" version = "0.6.0" edition = "2021" -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +[lints] +workspace = true [lib] crate-type = ["lib"] diff --git a/src/server/mod.rs b/src/server/mod.rs index 7d35cf9..47e1146 100644 --- a/src/server/mod.rs +++ b/src/server/mod.rs @@ -1199,8 +1199,7 @@ impl ServerState { let old_role_type = std::mem::discriminant(role); assert_eq!( new_role_type, old_role_type, - "Surface for {:?} already had a role: {:?}", - window, role + "Surface for {window:?} already had a role: {role:?}" ); } diff --git a/src/xstate/mod.rs b/src/xstate/mod.rs index fa036a9..32427df 100644 --- a/src/xstate/mod.rs +++ b/src/xstate/mod.rs @@ -330,7 +330,7 @@ impl XState { match event { xcb::Event::X(x::Event::CreateNotify(e)) => { - debug!("new window: {:?}", e); + debug!("new window: {e:?}"); server_state.new_window( e.window(), e.override_redirect(), @@ -702,7 +702,7 @@ impl XState { data.push(0); } let class = CString::from_vec_with_nul(data).unwrap(); - trace!("{:?} class: {class:?}", window); + trace!("{window:?} class: {class:?}"); class.to_string_lossy().to_string() }; PropertyCookieWrapper { @@ -1236,7 +1236,7 @@ impl XConnection for RealConnection { revert_to: x::InputFocus::None, time: x::CURRENT_TIME, }) { - debug!("SetInputFocus failed ({:?}: {:?})", window, e); + debug!("SetInputFocus failed ({window:?}: {e:?})"); return; } if let Err(e) = self.connection.send_and_check_request(&x::ChangeProperty { @@ -1246,7 +1246,7 @@ impl XConnection for RealConnection { r#type: x::ATOM_WINDOW, data: &[window], }) { - debug!("ChangeProperty failed ({:?}: {:?})", window, e); + debug!("ChangeProperty failed ({window:?}: {e:?})"); } if let Err(e) = self.connection.send_and_check_request(&x::ChangeProperty { mode: x::PropMode::Replace, @@ -1255,7 +1255,7 @@ impl XConnection for RealConnection { r#type: self.atoms.wm_state, data: &[WmState::Normal as u32, 0], }) { - debug!("ChangeProperty failed ({:?}: {:?})", window, e); + debug!("ChangeProperty failed ({window:?}: {e:?})"); } if let Some(name) = output_name { diff --git a/src/xstate/selection.rs b/src/xstate/selection.rs index 419b67c..50a2a82 100644 --- a/src/xstate/selection.rs +++ b/src/xstate/selection.rs @@ -386,7 +386,7 @@ impl XState { let Some(target) = mimes.iter().find(|t| t.atom == other) else { if log::log_enabled!(log::Level::Debug) { let name = get_atom_name(&self.connection, other); - debug!("refusing selection request because given atom could not be found ({})", name); + debug!("refusing selection request because given atom could not be found ({name})"); } refuse(); return true; @@ -447,7 +447,7 @@ impl XState { } fn handle_new_selection_owner(&mut self, owner: x::Window, timestamp: u32) { - debug!("new selection owner: {:?}", owner); + debug!("new selection owner: {owner:?}"); self.selection_data.last_selection_timestamp = timestamp; // Grab targets self.connection diff --git a/testwl/Cargo.toml b/testwl/Cargo.toml index 2ffa563..243f734 100644 --- a/testwl/Cargo.toml +++ b/testwl/Cargo.toml @@ -3,6 +3,9 @@ name = "testwl" version = "0.1.0" edition = "2021" +[lints] +workspace = true + [dependencies] wayland-protocols = { workspace = true, features = ["server", "unstable"] } wayland-server.workspace = true diff --git a/testwl/src/lib.rs b/testwl/src/lib.rs index e9ba96a..01c1eea 100644 --- a/testwl/src/lib.rs +++ b/testwl/src/lib.rs @@ -365,7 +365,7 @@ impl State { .expect("Surface does not exist"); match &mut surface.role { Some(SurfaceRole::Toplevel(t)) => t, - other => panic!("Surface does not have toplevel role: {:?}", other), + other => panic!("Surface does not have toplevel role: {other:?}"), } } @@ -1283,7 +1283,7 @@ impl Dispatch for State { let states = toplevel.states.clone(); state.configure_toplevel(*surface_id, 100, 100, states); } - xdg_toplevel::Request::UnsetFullscreen { .. } => { + xdg_toplevel::Request::UnsetFullscreen => { let data = state.surfaces.get_mut(surface_id).unwrap(); let Some(SurfaceRole::Toplevel(toplevel)) = &mut data.role else { unreachable!(); @@ -1667,7 +1667,7 @@ impl Dispatch for State { let data = state .surfaces .get_mut(&SurfaceId(resource.id().protocol_id())) - .unwrap_or_else(|| panic!("{:?} missing from surface map", resource)); + .unwrap_or_else(|| panic!("{resource:?} missing from surface map")); match request { Attach { buffer, .. } => {