]> git.lizzy.rs Git - rust.git/commitdiff
simplify 'let question = ...;'
authorMazdak Farrokhzad <twingoow@gmail.com>
Sun, 8 Dec 2019 10:57:18 +0000 (11:57 +0100)
committerMazdak Farrokhzad <twingoow@gmail.com>
Sat, 21 Dec 2019 18:20:41 +0000 (19:20 +0100)
src/librustc_parse/parser/ty.rs

index eadaf8ad716d39faaca610449d8985ce2f1c4fc5..c97220458757440786c3e6042adcf4624c33205d 100644 (file)
@@ -426,7 +426,7 @@ fn parse_generic_bound(
         let has_parens = self.eat(&token::OpenDelim(token::Paren));
         let inner_lo = self.token.span;
         let is_negative = self.eat(&token::Not);
-        let question = if self.eat(&token::Question) { Some(self.prev_span) } else { None };
+        let question = self.eat(&token::Question).then_some(self.prev_span);
         if self.token.is_lifetime() {
             Ok(Ok(self.parse_generic_lt_bound(lo, inner_lo, has_parens, question)?))
         } else {