Take slice instead of array in set_workspace_coordinates
As far as I can tell this is equivalent, and there's no particular reason to use an array. Arrays of options for variable-length arrays are awkward.
This commit is contained in:
parent
7340e2beff
commit
8d6bd47bc4
2 changed files with 3 additions and 11 deletions
|
|
@ -4023,7 +4023,7 @@ fn workspace_set_idx(
|
|||
handle: &WorkspaceHandle,
|
||||
) {
|
||||
state.set_workspace_name(handle, format!("{}", idx));
|
||||
state.set_workspace_coordinates(handle, [Some(idx as u32), Some(output_pos as u32), None]);
|
||||
state.set_workspace_coordinates(handle, &[idx as u32, output_pos as u32]);
|
||||
}
|
||||
|
||||
pub fn check_grab_preconditions(
|
||||
|
|
|
|||
|
|
@ -669,22 +669,14 @@ where
|
|||
self.0.workspace_coordinates(workspace)
|
||||
}
|
||||
|
||||
pub fn set_workspace_coordinates(
|
||||
&mut self,
|
||||
workspace: &WorkspaceHandle,
|
||||
coords: [Option<u32>; 3],
|
||||
) {
|
||||
pub fn set_workspace_coordinates(&mut self, workspace: &WorkspaceHandle, coords: &[u32]) {
|
||||
if let Some(workspace) = self
|
||||
.0
|
||||
.groups
|
||||
.iter_mut()
|
||||
.find_map(|g| g.workspaces.iter_mut().find(|w| w.id == workspace.id))
|
||||
{
|
||||
workspace.coordinates = coords
|
||||
.iter()
|
||||
.flat_map(std::convert::identity)
|
||||
.copied()
|
||||
.collect();
|
||||
workspace.coordinates = coords.to_vec();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue