cargo clippy everywhere

This commit is contained in:
Shawn Wallace 2025-07-12 12:29:33 -04:00
parent 07847e11d7
commit e4bb8c3f9d
7 changed files with 18 additions and 15 deletions

View file

@ -81,4 +81,4 @@ jobs:
- name: Format check
run: cargo fmt --check
- name: Clippy
run: cargo clippy
run: cargo clippy --workspace --all-targets

View file

@ -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"]

View file

@ -1199,8 +1199,7 @@ impl<C: XConnection> ServerState<C> {
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:?}"
);
}

View file

@ -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 {

View file

@ -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

View file

@ -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

View file

@ -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<XdgToplevel, SurfaceId> 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<WlSurface, ()> 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, .. } => {