Lint fixes (#99)

* Replace a single-character string literal with a character literal.

* Use is_some() instead of comparing with Some(_).

* Add code-quotes around type names in comments.

* Use !...is_empty() instead of len() != 0.

* Tidy up redundant returns.

* Remove redundant .clone() calls.

* Remove unnecessary explicit lifetime parameters.

* Tidy up unnecessary '&'s.

* Add parens to make operator precedence explicit.

* Use debug_assert_eq instead of debug_assert with ==.

* Replace a &Vec argument with a &[...].

* Replace `a = a op b` with `a op= b`.

* Avoid unnecessary closures.

* Avoid .iter() and .iter_mut() for iterating over containers.

* Remove unneeded qualification.
This commit is contained in:
Dan Gohman
2017-06-19 16:24:10 -07:00
committed by Jakob Stoklund Olesen
parent 1a480a2578
commit 61a0844b24
24 changed files with 132 additions and 137 deletions

View File

@@ -282,7 +282,7 @@ impl<'a> Parser<'a> {
None => break,
}
}
return self.lookahead;
self.lookahead
}
// Begin gathering comments associated with `entity`.
@@ -397,7 +397,7 @@ impl<'a> Parser<'a> {
fn error(&self, message: &str) -> Error {
Error {
location: self.loc.clone(),
location: self.loc,
message: message.to_string(),
}
}
@@ -1066,7 +1066,7 @@ impl<'a> Parser<'a> {
self.consume();
self.parse_instruction(results, encoding, result_locations, ctx, ebb)?;
}
_ if results.len() != 0 => return err!(self.loc, "expected -> or ="),
_ if !results.is_empty() => return err!(self.loc, "expected -> or ="),
_ => self.parse_instruction(results, encoding, result_locations, ctx, ebb)?,
}
}