summaryrefslogtreecommitdiff
path: root/src/desktop.rs
diff options
context:
space:
mode:
authorMatias Linares <matiaslina@openmailbox.org>2016-06-03 16:25:16 -0300
committerMatias Linares <matiaslina@openmailbox.org>2016-06-03 16:25:16 -0300
commit25034f8d4d70b4048d7540264fc18461982406aa (patch)
treebe189be1386f9e75b964ac7e0914832075cdeb1d /src/desktop.rs
parentda3fa00ccf4cde76d1d6489c6043d7e56d4f52c5 (diff)
downloaddotwm-25034f8d4d70b4048d7540264fc18461982406aa.tar.gz
Add Clippy as dependency.
This brings a lot of clean up on the code.
Diffstat (limited to 'src/desktop.rs')
-rw-r--r--src/desktop.rs23
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));