From 6b9e1d81f61a71368446ea62b704294051e9ecea Mon Sep 17 00:00:00 2001 From: DreamMaoMao <2523610504@qq.com> Date: Mon, 14 Oct 2024 17:43:41 +0800 Subject: [PATCH] optimize: optimize variable naming --- packages/wm/src/wm_state.rs | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/packages/wm/src/wm_state.rs b/packages/wm/src/wm_state.rs index af3171903..88599a312 100644 --- a/packages/wm/src/wm_state.rs +++ b/packages/wm/src/wm_state.rs @@ -303,35 +303,35 @@ impl WmState { .and_then(|name| self.workspace_by_name(&name)), ), WorkspaceTarget::NextActive => { - let workspaces = self.sorted_workspaces(config); - let origin_index = workspaces + let active_workspaces = self.sorted_workspaces(config); + let origin_index = active_workspaces .iter() .position(|workspace| workspace.id() == origin_workspace.id()) .context("Failed to get index of given workspace.")?; - let next_workspace = workspaces + let next_active_workspace = active_workspaces .get(origin_index + 1) - .or_else(|| workspaces.first()); + .or_else(|| active_workspaces.first()); ( - next_workspace.map(|workspace| workspace.config().name), - next_workspace.cloned(), + next_active_workspace.map(|workspace| workspace.config().name), + next_active_workspace.cloned(), ) } WorkspaceTarget::PreviousActive => { - let workspaces = self.sorted_workspaces(config); - let origin_index = workspaces + let active_workspaces = self.sorted_workspaces(config); + let origin_index = active_workspaces .iter() .position(|workspace| workspace.id() == origin_workspace.id()) .context("Failed to get index of given workspace.")?; - let prev_workspace = workspaces.get( - origin_index.checked_sub(1).unwrap_or(workspaces.len() - 1), + let prev_active_workspace = active_workspaces.get( + origin_index.checked_sub(1).unwrap_or(active_workspaces.len() - 1), ); ( - prev_workspace.map(|workspace| workspace.config().name), - prev_workspace.cloned(), + prev_active_workspace.map(|workspace| workspace.config().name), + prev_active_workspace.cloned(), ) } WorkspaceTarget::Next => {