about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2020-03-21 23:58:21 +0100
committerMatthias Krüger <matthias.krueger@famsik.de>2020-03-22 00:34:16 +0100
commit3599fd389de25af78a4616015fa937ff3aeb661a (patch)
treef42274a15c8cbd713a52fc468f491ae1a6132f1d
parent38114ff16e7856f98b2b4be7ab4cd29b38bed59a (diff)
downloadrust-3599fd389de25af78a4616015fa937ff3aeb661a.tar.gz
rust-3599fd389de25af78a4616015fa937ff3aeb661a.zip
summarize if-else-code with identical blocks (clippy::if_same_then_else)
-rw-r--r--src/librustc_parse/parser/stmt.rs8
1 files changed, 1 insertions, 7 deletions
diff --git a/src/librustc_parse/parser/stmt.rs b/src/librustc_parse/parser/stmt.rs
index d43f5d67113..fddfe48bf86 100644
--- a/src/librustc_parse/parser/stmt.rs
+++ b/src/librustc_parse/parser/stmt.rs
@@ -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.