Avoid unnecessarily unwrapping stack_ref() after is_stack()

In a lot of cases, matching on `stack_ref()` also works.
This commit is contained in:
Ian Douglas Scott 2026-06-18 19:43:45 -07:00 committed by Ian Douglas Scott
parent 26ee83aaa7
commit f765696834
4 changed files with 20 additions and 30 deletions

View file

@ -713,8 +713,7 @@ impl Workspace {
}
let mapped = self.element_for_surface(surface)?;
let maybe_stack = mapped.stack_ref().filter(|s| s.len() > 1);
if let Some(stack) = maybe_stack
if let Some(stack) = mapped.stack_ref()
&& stack.len() > 1
{
let idx = stack.surfaces().position(|s| &s == surface);