Skip to content

Commit 3b63465

Browse files
committed
parser/ty.rs: minor formatting tweaks
1 parent 0e74022 commit 3b63465

File tree

1 file changed

+23
-12
lines changed
  • src/librustc_parse/parser

1 file changed

+23
-12
lines changed

src/librustc_parse/parser/ty.rs

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,13 @@ impl<'a> Parser<'a> {
183183
}
184184
}
185185

186-
fn parse_remaining_bounds(&mut self, generic_params: Vec<GenericParam>, path: ast::Path,
187-
lo: Span, parse_plus: bool) -> PResult<'a, TyKind> {
186+
fn parse_remaining_bounds(
187+
&mut self,
188+
generic_params: Vec<GenericParam>,
189+
path: ast::Path,
190+
lo: Span,
191+
parse_plus: bool,
192+
) -> PResult<'a, TyKind> {
188193
let poly_trait_ref = PolyTraitRef::new(generic_params, path, lo.to(self.prev_span));
189194
let mut bounds = vec![GenericBound::Trait(poly_trait_ref, TraitBoundModifier::None)];
190195
if parse_plus {
@@ -338,8 +343,10 @@ impl<'a> Parser<'a> {
338343
.emit();
339344
}
340345

341-
pub(super) fn parse_generic_bounds(&mut self,
342-
colon_span: Option<Span>) -> PResult<'a, GenericBounds> {
346+
pub(super) fn parse_generic_bounds(
347+
&mut self,
348+
colon_span: Option<Span>,
349+
) -> PResult<'a, GenericBounds> {
343350
self.parse_generic_bounds_common(true, colon_span)
344351
}
345352

@@ -351,20 +358,24 @@ impl<'a> Parser<'a> {
351358
/// TY_BOUND = TY_BOUND_NOPAREN | (TY_BOUND_NOPAREN)
352359
/// TY_BOUND_NOPAREN = [?] [for<LT_PARAM_DEFS>] SIMPLE_PATH (e.g., `?for<'a: 'b> m::Trait<'a>`)
353360
/// ```
354-
fn parse_generic_bounds_common(&mut self,
355-
allow_plus: bool,
356-
colon_span: Option<Span>) -> PResult<'a, GenericBounds> {
361+
fn parse_generic_bounds_common(
362+
&mut self,
363+
allow_plus: bool,
364+
colon_span: Option<Span>,
365+
) -> PResult<'a, GenericBounds> {
357366
let mut bounds = Vec::new();
358367
let mut negative_bounds = Vec::new();
359368
let mut last_plus_span = None;
360369
let mut was_negative = false;
361370
loop {
362371
// This needs to be synchronized with `TokenKind::can_begin_bound`.
363-
let is_bound_start = self.check_path() || self.check_lifetime() ||
364-
self.check(&token::Not) || // used for error reporting only
365-
self.check(&token::Question) ||
366-
self.check_keyword(kw::For) ||
367-
self.check(&token::OpenDelim(token::Paren));
372+
let is_bound_start = self.check_path()
373+
|| self.check_lifetime()
374+
|| self.check(&token::Not) // Used for error reporting only.
375+
|| self.check(&token::Question)
376+
|| self.check_keyword(kw::For)
377+
|| self.check(&token::OpenDelim(token::Paren));
378+
368379
if is_bound_start {
369380
let lo = self.token.span;
370381
let has_parens = self.eat(&token::OpenDelim(token::Paren));

0 commit comments

Comments
 (0)