]> git.lizzy.rs Git - rust.git/commitdiff
summarize if-else-code with identical blocks (clippy::if_same_then_else)
authorMatthias Krüger <matthias.krueger@famsik.de>
Sat, 21 Mar 2020 22:58:21 +0000 (23:58 +0100)
committerMatthias Krüger <matthias.krueger@famsik.de>
Sat, 21 Mar 2020 23:34:16 +0000 (00:34 +0100)
src/librustc_parse/parser/stmt.rs

index d43f5d67113a1e348055e6dabda92ef4757bf5a5..fddfe48bf86700969e5b5f431418f493a2b8b17d 100644 (file)
@@ -217,13 +217,7 @@ fn parse_local(&mut self, attrs: AttrVec) -> PResult<'a, P<Local>> {
 
     /// 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.