about summary refs log tree commit diff
path: root/src/librustc_parse/parser
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-12-08 09:42:32 +0100
committerMazdak Farrokhzad <twingoow@gmail.com>2019-12-21 19:20:41 +0100
commite61cb44f2f55a79562d1c714b42620c81c962d5d (patch)
tree6e37ea3955bc3793ce4e9cb85680a92b01543247 /src/librustc_parse/parser
parenta11252ae266ded70e47ede20e68a41f611d2280b (diff)
downloadrust-e61cb44f2f55a79562d1c714b42620c81c962d5d.tar.gz
rust-e61cb44f2f55a79562d1c714b42620c81c962d5d.zip
parse_generic_bounds_common: dedent
Diffstat (limited to 'src/librustc_parse/parser')
-rw-r--r--src/librustc_parse/parser/ty.rs64
1 files changed, 32 insertions, 32 deletions
diff --git a/src/librustc_parse/parser/ty.rs b/src/librustc_parse/parser/ty.rs
index 2b642ad2de7..b58c16c78e6 100644
--- a/src/librustc_parse/parser/ty.rs
+++ b/src/librustc_parse/parser/ty.rs
@@ -376,42 +376,42 @@ impl<'a> Parser<'a> {
                 || self.check_keyword(kw::For)
                 || self.check(&token::OpenDelim(token::Paren));
 
-            if is_bound_start {
-                let lo = self.token.span;
-                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 };
-                if self.token.is_lifetime() {
-                    self.error_opt_out_lifetime(question);
-                    bounds.push(GenericBound::Outlives(self.expect_lifetime()));
-                    if has_parens {
-                        self.recover_paren_lifetime(lo, inner_lo)?;
+            if !is_bound_start {
+                break;
+            }
+
+            let lo = self.token.span;
+            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 };
+            if self.token.is_lifetime() {
+                self.error_opt_out_lifetime(question);
+                bounds.push(GenericBound::Outlives(self.expect_lifetime()));
+                if has_parens {
+                    self.recover_paren_lifetime(lo, inner_lo)?;
+                }
+            } else {
+                let lifetime_defs = self.parse_late_bound_lifetime_defs()?;
+                let path = self.parse_path(PathStyle::Type)?;
+                if has_parens {
+                    self.expect(&token::CloseDelim(token::Paren))?;
+                }
+                let poly_span = lo.to(self.prev_span);
+                if is_negative {
+                    was_negative = true;
+                    if let Some(sp) = last_plus_span.or(colon_span) {
+                        negative_bounds.push(sp.to(poly_span));
                     }
                 } else {
-                    let lifetime_defs = self.parse_late_bound_lifetime_defs()?;
-                    let path = self.parse_path(PathStyle::Type)?;
-                    if has_parens {
-                        self.expect(&token::CloseDelim(token::Paren))?;
-                    }
-                    let poly_span = lo.to(self.prev_span);
-                    if is_negative {
-                        was_negative = true;
-                        if let Some(sp) = last_plus_span.or(colon_span) {
-                            negative_bounds.push(sp.to(poly_span));
-                        }
+                    let poly_trait = PolyTraitRef::new(lifetime_defs, path, poly_span);
+                    let modifier = if question.is_some() {
+                        TraitBoundModifier::Maybe
                     } else {
-                        let poly_trait = PolyTraitRef::new(lifetime_defs, path, poly_span);
-                        let modifier = if question.is_some() {
-                            TraitBoundModifier::Maybe
-                        } else {
-                            TraitBoundModifier::None
-                        };
-                        bounds.push(GenericBound::Trait(poly_trait, modifier));
-                    }
+                        TraitBoundModifier::None
+                    };
+                    bounds.push(GenericBound::Trait(poly_trait, modifier));
                 }
-            } else {
-                break
             }
 
             if !allow_plus || !self.eat_plus() {