From 3f499a97e43b9f1cd23233de542419921ea4b6d0 Mon Sep 17 00:00:00 2001 From: Mazdak Farrokhzad Date: Sun, 8 Dec 2019 09:10:17 +0100 Subject: [PATCH] parser/ty.rs: minor formatting tweaks --- src/librustc_parse/parser/ty.rs | 35 ++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/src/librustc_parse/parser/ty.rs b/src/librustc_parse/parser/ty.rs index d9938a81240..a4c1f530ef8 100644 --- a/src/librustc_parse/parser/ty.rs +++ b/src/librustc_parse/parser/ty.rs @@ -183,8 +183,13 @@ fn parse_ty_tuple_or_parens(&mut self, lo: Span, allow_plus: bool) -> PResult<'a } } - fn parse_remaining_bounds(&mut self, generic_params: Vec, path: ast::Path, - lo: Span, parse_plus: bool) -> PResult<'a, TyKind> { + fn parse_remaining_bounds( + &mut self, + generic_params: Vec, + path: ast::Path, + lo: Span, + parse_plus: bool, + ) -> PResult<'a, TyKind> { let poly_trait_ref = PolyTraitRef::new(generic_params, path, lo.to(self.prev_span)); let mut bounds = vec![GenericBound::Trait(poly_trait_ref, TraitBoundModifier::None)]; if parse_plus { @@ -338,8 +343,10 @@ fn error_illegal_c_varadic_ty(&self, lo: Span) { .emit(); } - pub(super) fn parse_generic_bounds(&mut self, - colon_span: Option) -> PResult<'a, GenericBounds> { + pub(super) fn parse_generic_bounds( + &mut self, + colon_span: Option, + ) -> PResult<'a, GenericBounds> { self.parse_generic_bounds_common(true, colon_span) } @@ -351,20 +358,24 @@ pub(super) fn parse_generic_bounds(&mut self, /// TY_BOUND = TY_BOUND_NOPAREN | (TY_BOUND_NOPAREN) /// TY_BOUND_NOPAREN = [?] [for] SIMPLE_PATH (e.g., `?for<'a: 'b> m::Trait<'a>`) /// ``` - fn parse_generic_bounds_common(&mut self, - allow_plus: bool, - colon_span: Option) -> PResult<'a, GenericBounds> { + fn parse_generic_bounds_common( + &mut self, + allow_plus: bool, + colon_span: Option, + ) -> PResult<'a, GenericBounds> { let mut bounds = Vec::new(); let mut negative_bounds = Vec::new(); let mut last_plus_span = None; let mut was_negative = false; loop { // This needs to be synchronized with `TokenKind::can_begin_bound`. - let is_bound_start = self.check_path() || self.check_lifetime() || - self.check(&token::Not) || // used for error reporting only - self.check(&token::Question) || - self.check_keyword(kw::For) || - self.check(&token::OpenDelim(token::Paren)); + let is_bound_start = self.check_path() + || self.check_lifetime() + || self.check(&token::Not) // Used for error reporting only. + || self.check(&token::Question) + || 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)); -- 2.44.0