diff options
Diffstat (limited to 'src/desktop.rs')
-rw-r--r-- | src/desktop.rs | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/src/desktop.rs b/src/desktop.rs index afe6a28..aac472f 100644 --- a/src/desktop.rs +++ b/src/desktop.rs @@ -69,18 +69,15 @@ impl Desktop { pub fn remove_window(&mut self, w: xlib::Window) { let pos = self.window_list.iter().position(|xw| xw.inner == w); - match pos { - Some(idx) => { - let new_idx = if idx == 0 { - if self.window_list.len() == 1 { usize::max_value() } else { 0 } - } else { - idx - 1 - }; - self.window_list.remove(idx); - self.cw_idx = new_idx; - self.focus_current_window(); - }, - None => (), + if let Some(idx) = pos { + let new_idx = if idx == 0 { + if self.window_list.len() == 1 { usize::max_value() } else { 0 } + } else { + idx - 1 + }; + self.window_list.remove(idx); + self.cw_idx = new_idx; + self.focus_current_window(); } } @@ -160,7 +157,7 @@ impl Desktop { (screen_width as i32, screen_height as i32), ]; - for w in self.window_list.iter() { + for w in &self.window_list { let attrs = w.attributes(); result.push((attrs.x, attrs.y)); result.push((attrs.x + attrs.width, attrs.y + attrs.height)); |