Skip to content

Commit ba1a1dd

Browse files
committed
Fix some formatting.
Must be one of those cases where the function is too long and rustfmt bails out.
1 parent 593cf68 commit ba1a1dd

File tree

1 file changed

+15
-5
lines changed
  • compiler/rustc_parse/src/lexer

1 file changed

+15
-5
lines changed

compiler/rustc_parse/src/lexer/mod.rs

+15-5
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,8 @@ impl<'psess, 'src> Lexer<'psess, 'src> {
240240
.push(span);
241241
token::Ident(sym, IdentIsRaw::No)
242242
}
243-
// split up (raw) c string literals to an ident and a string literal when edition < 2021.
243+
// split up (raw) c string literals to an ident and a string literal when edition <
244+
// 2021.
244245
rustc_lexer::TokenKind::Literal {
245246
kind: kind @ (LiteralKind::CStr { .. } | LiteralKind::RawCStr { .. }),
246247
suffix_start: _,
@@ -261,7 +262,9 @@ impl<'psess, 'src> Lexer<'psess, 'src> {
261262
let prefix_span = self.mk_sp(start, lit_start);
262263
return (Token::new(self.ident(start), prefix_span), preceded_by_whitespace);
263264
}
264-
rustc_lexer::TokenKind::GuardedStrPrefix => self.maybe_report_guarded_str(start, str_before),
265+
rustc_lexer::TokenKind::GuardedStrPrefix => {
266+
self.maybe_report_guarded_str(start, str_before)
267+
}
265268
rustc_lexer::TokenKind::Literal { kind, suffix_start } => {
266269
let suffix_start = start + BytePos(suffix_start);
267270
let (kind, symbol) = self.cook_lexer_literal(start, suffix_start, kind);
@@ -305,13 +308,20 @@ impl<'psess, 'src> Lexer<'psess, 'src> {
305308
if prefix_span.at_least_rust_2021() {
306309
let span = self.mk_sp(start, self.pos);
307310

308-
let lifetime_name_without_tick = Symbol::intern(&self.str_from(ident_start));
311+
let lifetime_name_without_tick =
312+
Symbol::intern(&self.str_from(ident_start));
309313
if !lifetime_name_without_tick.can_be_raw() {
310-
self.dcx().emit_err(errors::CannotBeRawLifetime { span, ident: lifetime_name_without_tick });
314+
self.dcx().emit_err(
315+
errors::CannotBeRawLifetime {
316+
span,
317+
ident: lifetime_name_without_tick
318+
}
319+
);
311320
}
312321

313322
// Put the `'` back onto the lifetime name.
314-
let mut lifetime_name = String::with_capacity(lifetime_name_without_tick.as_str().len() + 1);
323+
let mut lifetime_name =
324+
String::with_capacity(lifetime_name_without_tick.as_str().len() + 1);
315325
lifetime_name.push('\'');
316326
lifetime_name += lifetime_name_without_tick.as_str();
317327
let sym = Symbol::intern(&lifetime_name);

0 commit comments

Comments
 (0)