Skip to content

Commit

Permalink
summarize if-else-code with identical blocks (clippy::if_same_then_else)
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiaskrgr committed Mar 21, 2020
1 parent 38114ff commit 3599fd3
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions src/librustc_parse/parser/stmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,13 +217,7 @@ impl<'a> Parser<'a> {

/// Parses the RHS of a local variable declaration (e.g., '= 14;').
fn parse_initializer(&mut self, skip_eq: bool) -> PResult<'a, Option<P<Expr>>> {
if self.eat(&token::Eq) {
Ok(Some(self.parse_expr()?))
} else if skip_eq {
Ok(Some(self.parse_expr()?))
} else {
Ok(None)
}
if self.eat(&token::Eq) || skip_eq { Ok(Some(self.parse_expr()?)) } else { Ok(None) }
}

/// Parses a block. No inner attributes are allowed.
Expand Down

0 comments on commit 3599fd3

Please sign in to comment.