aboutsummaryrefslogtreecommitdiff
path: root/src/socket
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/socket
parentda3fa00ccf4cde76d1d6489c6043d7e56d4f52c5 (diff)
downloaddotwm-25034f8d4d70b4048d7540264fc18461982406aa.tar.gz
Add Clippy as dependency.
This brings a lot of clean up on the code.
Diffstat (limited to 'src/socket')
-rw-r--r--src/socket/mod.rs13
-rw-r--r--src/socket/parser.rs8
2 files changed, 9 insertions, 12 deletions
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<u32, &'static str> {
fn modifiers<'a>(s: &'a str) -> Result<Vec<u32>, &'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<ParsedCmd<'a>, &'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<ParsedCmd<'a>, &'static str> {
Err("missing arguments")
}
},
- &"exec" => {
+ "exec" => {
Ok(ParsedCmd {
f: FnType::Exec,
modifiers: vec![],