diff options
author | Corey Farwell <coreyf@rwell.org> | 2016-01-20 23:30:45 -0500 |
---|---|---|
committer | Corey Farwell <coreyf@rwell.org> | 2016-01-21 08:38:09 -0500 |
commit | 7be39d725d6d251366d1cbd2566651b011cdb5a3 (patch) | |
tree | 5233aac487e0871823267670b58310a3ab24e8bf /src/parser.rs | |
parent | 6fe6a15fe526b08010ff3e6acaf52d3665d34d6b (diff) | |
download | milf-rs-7be39d725d6d251366d1cbd2566651b011cdb5a3.tar.gz milf-rs-7be39d725d6d251366d1cbd2566651b011cdb5a3.zip |
Address issues found by rust-clippy
Diffstat (limited to 'src/parser.rs')
-rw-r--r-- | src/parser.rs | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/parser.rs b/src/parser.rs index 190454c..38edd20 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -153,7 +153,7 @@ impl<'a> Parser<'a> { } cur += line.len() + 1; } - return (self.input.lines().count(), 0) + (self.input.lines().count(), 0) } fn next_pos(&self) -> usize { @@ -265,7 +265,7 @@ impl<'a> Parser<'a> { } if !self.expect('.') { return None } } - if keys.len() == 0 { return None } + if keys.is_empty() { return None } // Build the section table let mut table = TomlTable { @@ -283,7 +283,7 @@ impl<'a> Parser<'a> { if !self.values(&mut ret) { return None } } } - if self.errors.len() > 0 { + if !self.errors.is_empty() { None } else { Some(ret.convert()) @@ -309,7 +309,7 @@ impl<'a> Parser<'a> { Some(ret) }; match key { - Some(ref name) if name.len() == 0 => { + Some(ref name) if name.is_empty() => { self.errors.push(ParserError { lo: start, hi: start, @@ -349,7 +349,7 @@ impl<'a> Parser<'a> { self.comment(); self.newline(); } - return true + true } fn keyval_sep(&mut self) -> bool { @@ -381,7 +381,7 @@ impl<'a> Parser<'a> { hi: hi, desc: format!("expected a value"), }); - return None + None } } } @@ -558,7 +558,7 @@ impl<'a> Parser<'a> { } } - return Some(Value::String(ret)); + Some(Value::String(ret)) } fn number_or_datetime(&mut self, start: usize) -> Option<Value> { @@ -602,7 +602,7 @@ impl<'a> Parser<'a> { desc: format!("invalid numeric literal"), }); } - return ret; + ret } fn integer(&mut self, start: usize, allow_leading_zeros: bool, @@ -662,7 +662,7 @@ impl<'a> Parser<'a> { hi: pos, desc: format!("numeral cannot end with an underscore"), }); - return None + None } else { Some(s) } @@ -780,7 +780,7 @@ impl<'a> Parser<'a> { } consume(self); if !self.expect(']') { return None } - return Some(Value::Array(ret)) + Some(Value::Array(ret)) } fn inline_table(&mut self, _start: usize) -> Option<Value> { @@ -800,7 +800,7 @@ impl<'a> Parser<'a> { if !self.expect(',') { return None } self.ws(); } - return Some(Value::Table(ret)) + Some(Value::Table(ret)) } fn insert(&mut self, into: &mut TomlTable, key: String, value: Value, |