From 25034f8d4d70b4048d7540264fc18461982406aa Mon Sep 17 00:00:00 2001 From: Matias Linares Date: Fri, 3 Jun 2016 16:25:16 -0300 Subject: Add Clippy as dependency. This brings a lot of clean up on the code. --- src/desktop.rs | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) (limited to 'src/desktop.rs') 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)); -- cgit v1.2.3-70-g09d2