From 52ad30c264093a9eb4f3bb94e437fd47d68739c3 Mon Sep 17 00:00:00 2001 From: julianbraha Date: Fri, 30 Aug 2024 13:58:49 +0100 Subject: [PATCH] Remove unnecessary lifetimes --- src/backend/kms/surface/mod.rs | 2 +- src/backend/render/element.rs | 4 ++-- src/config/mod.rs | 2 +- src/shell/element/mod.rs | 12 ++++++------ src/shell/focus/mod.rs | 2 +- src/shell/layout/floating/mod.rs | 6 +++--- src/shell/layout/tiling/mod.rs | 16 ++++------------ src/shell/mod.rs | 20 ++++++++------------ src/shell/workspace.rs | 4 ++-- src/wayland/handlers/compositor.rs | 2 +- src/wayland/protocols/workspace.rs | 2 +- 11 files changed, 30 insertions(+), 42 deletions(-) diff --git a/src/backend/kms/surface/mod.rs b/src/backend/kms/surface/mod.rs index 8b866dad..ebc5c6ee 100644 --- a/src/backend/kms/surface/mod.rs +++ b/src/backend/kms/surface/mod.rs @@ -1329,7 +1329,7 @@ impl SurfaceThreadState { } } -fn source_node_for_surface<'a>(w: &WlSurface) -> Option { +fn source_node_for_surface(w: &WlSurface) -> Option { with_renderer_surface_state(w, |state| { state .buffer() diff --git a/src/backend/render/element.rs b/src/backend/render/element.rs index 26fca22c..dfedb3b8 100644 --- a/src/backend/render/element.rs +++ b/src/backend/render/element.rs @@ -186,9 +186,9 @@ where ::Error: FromGlesError, CosmicMappedRenderElement: RenderElement, { - fn draw<'frame>( + fn draw( &self, - frame: &mut R::Frame<'frame>, + frame: &mut R::Frame<'_>, src: Rectangle, dst: Rectangle, damage: &[Rectangle], diff --git a/src/config/mod.rs b/src/config/mod.rs index d8a5e0fa..01c7cd0e 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -545,7 +545,7 @@ impl DynamicConfig { &self.outputs.1 } - pub fn outputs_mut<'a>(&'a mut self) -> PersistenceGuard<'a, OutputsConfig> { + pub fn outputs_mut(&mut self) -> PersistenceGuard<'_, OutputsConfig> { PersistenceGuard(self.outputs.0.clone(), &mut self.outputs.1) } } diff --git a/src/shell/element/mod.rs b/src/shell/element/mod.rs index f0e8b7b0..501ead8f 100644 --- a/src/shell/element/mod.rs +++ b/src/shell/element/mod.rs @@ -588,9 +588,9 @@ impl CosmicMapped { } } - pub fn convert_to_stack<'a>( + pub fn convert_to_stack( &mut self, - (output, overlap): (&'a Output, Rectangle), + (output, overlap): (&Output, Rectangle), theme: cosmic::Theme, ) { match &self.element { @@ -614,10 +614,10 @@ impl CosmicMapped { } } - pub fn convert_to_surface<'a>( + pub fn convert_to_surface( &mut self, surface: CosmicSurface, - (output, overlap): (&'a Output, Rectangle), + (output, overlap): (&Output, Rectangle), theme: cosmic::Theme, ) { let handle = self.loop_handle(); @@ -1276,9 +1276,9 @@ where ::TextureId: 'static, ::Error: FromGlesError, { - fn draw<'frame>( + fn draw( &self, - frame: &mut R::Frame<'frame>, + frame: &mut R::Frame<'_>, src: Rectangle, dst: Rectangle, damage: &[Rectangle], diff --git a/src/shell/focus/mod.rs b/src/shell/focus/mod.rs index bf19bc3f..4915e19f 100644 --- a/src/shell/focus/mod.rs +++ b/src/shell/focus/mod.rs @@ -166,7 +166,7 @@ impl Shell { } } - fn update_active<'a, 'b>(&mut self) { + fn update_active(&mut self) { // update activate status let focused_windows = self .seats diff --git a/src/shell/layout/floating/mod.rs b/src/shell/layout/floating/mod.rs index c0ff2ad2..db666277 100644 --- a/src/shell/layout/floating/mod.rs +++ b/src/shell/layout/floating/mod.rs @@ -953,7 +953,7 @@ impl FloatingLayout { } } - pub fn toggle_stacking_focused<'a>( + pub fn toggle_stacking_focused( &mut self, seat: &Seat, focus_stack: FocusStackMut, @@ -966,7 +966,7 @@ impl FloatingLayout { self.toggle_stacking(&elem, focus_stack) } - pub fn move_element<'a>( + pub fn move_element( &mut self, direction: Direction, seat: &Seat, @@ -1133,7 +1133,7 @@ impl FloatingLayout { } } - pub fn move_current_element<'a>( + pub fn move_current_element( &mut self, direction: Direction, seat: &Seat, diff --git a/src/shell/layout/tiling/mod.rs b/src/shell/layout/tiling/mod.rs index 3a05e6f0..3283ba59 100644 --- a/src/shell/layout/tiling/mod.rs +++ b/src/shell/layout/tiling/mod.rs @@ -534,7 +534,7 @@ impl TilingLayout { self.map_internal(window, focus_stack, None, Some(from)); } - fn map_to_tree<'a>( + fn map_to_tree( mut tree: &mut Tree, window: impl Into, output: &Output, @@ -1467,11 +1467,7 @@ impl TilingLayout { } } - pub fn move_current_node<'a>( - &mut self, - direction: Direction, - seat: &Seat, - ) -> MoveResult { + pub fn move_current_node(&mut self, direction: Direction, seat: &Seat) -> MoveResult { let gaps = self.gaps(); let mut tree = self.queue.trees.back().unwrap().0.copy_clone(); @@ -2059,11 +2055,7 @@ impl TilingLayout { FocusResult::None } - pub fn update_orientation<'a>( - &mut self, - new_orientation: Option, - seat: &Seat, - ) { + pub fn update_orientation(&mut self, new_orientation: Option, seat: &Seat) { let gaps = self.gaps(); let Some(target) = seat.get_keyboard().unwrap().current_focus() else { @@ -2225,7 +2217,7 @@ impl TilingLayout { Some(result) } - pub fn toggle_stacking_focused<'a>( + pub fn toggle_stacking_focused( &mut self, seat: &Seat, mut focus_stack: FocusStackMut, diff --git a/src/shell/mod.rs b/src/shell/mod.rs index 96df55dc..7efa8fba 100644 --- a/src/shell/mod.rs +++ b/src/shell/mod.rs @@ -524,7 +524,7 @@ impl WorkspaceSet { self.output = new_output.clone(); } - fn refresh<'a>(&mut self, xdg_activation_state: &XdgActivationState) { + fn refresh(&mut self, xdg_activation_state: &XdgActivationState) { if let Some((_, start)) = self.previously_active { match start { WorkspaceDelta::Shortcut(st) => { @@ -567,7 +567,7 @@ impl WorkspaceSet { self.workspaces.push(workspace); } - fn ensure_last_empty<'a>(&mut self, state: &mut WorkspaceUpdateGuard) { + fn ensure_last_empty(&mut self, state: &mut WorkspaceUpdateGuard) { // add empty at the end, if necessary if self .workspaces @@ -2642,7 +2642,7 @@ impl Shell { } #[must_use] - pub fn next_focus<'a>(&self, direction: FocusDirection, seat: &Seat) -> FocusResult { + pub fn next_focus(&self, direction: FocusDirection, seat: &Seat) -> FocusResult { let overview = self.overview_mode().0; let output = seat.active_output(); @@ -2791,11 +2791,7 @@ impl Shell { } #[must_use] - pub fn move_current_element<'a>( - &mut self, - direction: Direction, - seat: &Seat, - ) -> MoveResult { + pub fn move_current_element(&mut self, direction: Direction, seat: &Seat) -> MoveResult { let output = seat.active_output(); let workspace = self.active_space(&output); let focus_stack = workspace.focus_stack.get(seat); @@ -3261,7 +3257,7 @@ impl Shell { } } - pub fn toggle_sticky<'a>(&mut self, seat: &Seat, mapped: &CosmicMapped) { + pub fn toggle_sticky(&mut self, seat: &Seat, mapped: &CosmicMapped) { // clean from focus-stacks for workspace in self.workspaces.spaces_mut() { for seat in self.seats.iter() { @@ -3335,7 +3331,7 @@ impl Shell { self.append_focus_stack(&mapped, seat); } - pub fn toggle_sticky_current<'a>(&mut self, seat: &Seat) { + pub fn toggle_sticky_current(&mut self, seat: &Seat) { let set = self.workspaces.sets.get_mut(&seat.active_output()).unwrap(); let workspace = &mut set.workspaces[set.active]; let maybe_window = workspace.focus_stack.get(seat).iter().next().cloned(); @@ -3428,8 +3424,8 @@ impl Shell { } } -fn workspace_set_idx<'a>( - state: &mut WorkspaceUpdateGuard<'a, State>, +fn workspace_set_idx( + state: &mut WorkspaceUpdateGuard<'_, State>, idx: u8, output_pos: usize, handle: &WorkspaceHandle, diff --git a/src/shell/workspace.rs b/src/shell/workspace.rs index 4037eed5..6fc25b5d 100644 --- a/src/shell/workspace.rs +++ b/src/shell/workspace.rs @@ -1339,9 +1339,9 @@ where ::TextureId: 'static, ::Error: FromGlesError, { - fn draw<'frame>( + fn draw( &self, - frame: &mut R::Frame<'frame>, + frame: &mut R::Frame<'_>, src: Rectangle, dst: Rectangle, damage: &[Rectangle], diff --git a/src/wayland/handlers/compositor.rs b/src/wayland/handlers/compositor.rs index 395aa229..edd6a143 100644 --- a/src/wayland/handlers/compositor.rs +++ b/src/wayland/handlers/compositor.rs @@ -79,7 +79,7 @@ fn layer_surface_check_inital_configure(surface: &LayerSurface) -> bool { initial_configure_sent } -pub fn client_compositor_state<'a>(client: &'a Client) -> &'a CompositorClientState { +pub fn client_compositor_state(client: &Client) -> &CompositorClientState { if let Some(state) = client.get_data::() { return &state.compositor_state; } diff --git a/src/wayland/protocols/workspace.rs b/src/wayland/protocols/workspace.rs index e1bd982e..60b1380c 100644 --- a/src/wayland/protocols/workspace.rs +++ b/src/wayland/protocols/workspace.rs @@ -567,7 +567,7 @@ where .cloned() } - pub fn update<'a>(&'a mut self) -> WorkspaceUpdateGuard<'a, D> { + pub fn update(&mut self) -> WorkspaceUpdateGuard<'_, D> { WorkspaceUpdateGuard(self) }