Skip to content

Commit 3599fd3

Browse files
committed
summarize if-else-code with identical blocks (clippy::if_same_then_else)
1 parent 38114ff commit 3599fd3

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

src/librustc_parse/parser/stmt.rs

+1-7
Original file line numberDiff line numberDiff line change
@@ -217,13 +217,7 @@ impl<'a> Parser<'a> {
217217

218218
/// Parses the RHS of a local variable declaration (e.g., '= 14;').
219219
fn parse_initializer(&mut self, skip_eq: bool) -> PResult<'a, Option<P<Expr>>> {
220-
if self.eat(&token::Eq) {
221-
Ok(Some(self.parse_expr()?))
222-
} else if skip_eq {
223-
Ok(Some(self.parse_expr()?))
224-
} else {
225-
Ok(None)
226-
}
220+
if self.eat(&token::Eq) || skip_eq { Ok(Some(self.parse_expr()?)) } else { Ok(None) }
227221
}
228222

229223
/// Parses a block. No inner attributes are allowed.

0 commit comments

Comments
 (0)