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/socket/mod.rs | 13 +++++-------- src/socket/parser.rs | 8 ++++---- 2 files changed, 9 insertions(+), 12 deletions(-) (limited to 'src/socket') diff --git a/src/socket/mod.rs b/src/socket/mod.rs index 66dae16..c29db2b 100644 --- a/src/socket/mod.rs +++ b/src/socket/mod.rs @@ -25,14 +25,11 @@ pub struct ParsedCmd<'a> { impl<'a> ParsedCmd<'a> { pub fn handle(self, wm: &mut DotWM, bindings: &mut BindingHash) { - match self.f { - FnType::Bind => { - let modifier: u32 = self.modifiers.iter() - .fold(0, |acc, x| acc | x ); - add_binding(wm, bindings, - self.key, modifier, self.func, &self.args); - }, - _ => (), + if self.f == FnType::Bind { + let modifier: u32 = self.modifiers.iter() + .fold(0, |acc, x| acc | x ); + add_binding(wm, bindings, + self.key, modifier, self.func, &self.args); } } } diff --git a/src/socket/parser.rs b/src/socket/parser.rs index 30487d8..e475962 100644 --- a/src/socket/parser.rs +++ b/src/socket/parser.rs @@ -36,7 +36,7 @@ fn modifier_from<'a>(s: &'a str) -> Result { fn modifiers<'a>(s: &'a str) -> Result, &'static str> { let mut result = vec![]; - for smod in s.split("-") { + for smod in s.split('-') { let modifier = simple_try!(modifier_from(smod)); result.push(modifier); } @@ -128,8 +128,8 @@ pub fn parse<'a>(input: &'a str) -> Result, &'static str> { match args.first() { Some(cmd) => { - match cmd { - &"bind" => { + match *cmd { + "bind" => { if args.len() > 2 { let modifiers = simple_try!(modifiers(args[1])); let key = simple_try!(key(args[2])); @@ -147,7 +147,7 @@ pub fn parse<'a>(input: &'a str) -> Result, &'static str> { Err("missing arguments") } }, - &"exec" => { + "exec" => { Ok(ParsedCmd { f: FnType::Exec, modifiers: vec![], -- cgit v1.2.3-70-g09d2