From 52280e9823506a480248e84caaf7545426a871c8 Mon Sep 17 00:00:00 2001 From: julianbraha Date: Tue, 3 Sep 2024 12:35:39 +0100 Subject: [PATCH] Remove unnecessary casting --- src/backend/winit.rs | 8 ++++---- src/input/mod.rs | 6 +++--- src/shell/mod.rs | 2 +- src/wayland/handlers/screencopy/render.rs | 8 ++++---- src/wayland/handlers/toplevel_management.rs | 2 +- src/xwayland.rs | 2 +- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/backend/winit.rs b/src/backend/winit.rs index 9d31248b..97f6d833 100644 --- a/src/backend/winit.rs +++ b/src/backend/winit.rs @@ -112,9 +112,9 @@ impl WinitState { .get::>() .unwrap() .borrow_mut(); - if dbg!(config.mode.0) != dbg!((size.w as i32, size.h as i32)) { + if dbg!(config.mode.0) != dbg!((size.w, size.h)) { if !test_only { - config.mode = ((size.w as i32, size.h as i32), None); + config.mode = ((size.w, size.h), None); } Err(anyhow::anyhow!("Cannot set window size")) } else { @@ -143,7 +143,7 @@ pub fn init_backend( model: name.clone(), }; let mode = Mode { - size: (size.w as i32, size.h as i32).into(), + size: (size.w, size.h).into(), refresh: 60_000, }; let output = Output::new(name, props); @@ -157,7 +157,7 @@ pub fn init_backend( ); output.user_data().insert_if_missing(|| { RefCell::new(OutputConfig { - mode: ((size.w as i32, size.h as i32), None), + mode: ((size.w, size.h), None), transform: Transform::Flipped180.into(), ..Default::default() }) diff --git a/src/input/mod.rs b/src/input/mod.rs index 2188305e..30473a1c 100644 --- a/src/input/mod.rs +++ b/src/input/mod.rs @@ -1881,7 +1881,7 @@ impl State { let res = shell.move_current_window( seat, ¤t_output, - (¤t_output, Some(workspace as usize)), + (¤t_output, Some(workspace)), matches!(x, Action::MoveToLastWorkspace), None, &mut self.common.workspace_state.update(), @@ -1904,7 +1904,7 @@ impl State { shell.move_current_window( seat, ¤t_output, - (¤t_output, Some(workspace as usize)), + (¤t_output, Some(workspace)), matches!(x, Action::MoveToNextWorkspace), direction, &mut self.common.workspace_state.update(), @@ -1949,7 +1949,7 @@ impl State { shell.move_current_window( seat, ¤t_output, - (¤t_output, Some(workspace as usize)), + (¤t_output, Some(workspace)), matches!(x, Action::MoveToPreviousWorkspace), direction, &mut self.common.workspace_state.update(), diff --git a/src/shell/mod.rs b/src/shell/mod.rs index 37e6ebfb..cfe98b49 100644 --- a/src/shell/mod.rs +++ b/src/shell/mod.rs @@ -2628,7 +2628,7 @@ impl Shell { seat, initial_window_location, cursor_output, - active_hint as u8, + active_hint, layer, release, evlh.clone(), diff --git a/src/wayland/handlers/screencopy/render.rs b/src/wayland/handlers/screencopy/render.rs index 5db5f656..b0bd12ec 100644 --- a/src/wayland/handlers/screencopy/render.rs +++ b/src/wayland/handlers/screencopy/render.rs @@ -80,10 +80,10 @@ where if matches!(buffer_type(&buffer), Some(BufferType::Shm)) { let buffer_size = buffer_dimensions(&buffer).unwrap(); if let Err(err) = with_buffer_contents_mut(&buffer, |ptr, len, data| { - let offset = data.offset as i32; - let width = data.width as i32; - let height = data.height as i32; - let stride = data.stride as i32; + let offset = data.offset; + let width = data.width; + let height = data.height; + let stride = data.stride; let format = shm_format_to_fourcc(data.format) .expect("We should be able to convert all hardcoded shm screencopy formats"); diff --git a/src/wayland/handlers/toplevel_management.rs b/src/wayland/handlers/toplevel_management.rs index 0f9c8f48..a6e468f5 100644 --- a/src/wayland/handlers/toplevel_management.rs +++ b/src/wayland/handlers/toplevel_management.rs @@ -55,7 +55,7 @@ impl ToplevelManagementHandler for State { let res = shell.activate( &output, - idx as usize, + idx, WorkspaceDelta::new_shortcut(), &mut self.common.workspace_state.update(), ); diff --git a/src/xwayland.rs b/src/xwayland.rs index 4262b3ca..bd6371ef 100644 --- a/src/xwayland.rs +++ b/src/xwayland.rs @@ -254,7 +254,7 @@ impl Common { .outputs() .map(|o| o.current_scale().integer_scale()) .max() - .unwrap_or(1) as i32 + .unwrap_or(1) } else { 1 };