Skip to content

Commit c7fcbfb

Browse files
committed
Auto merge of #60182 - matklad:lexer-cleanup, r=petrochenkov
Lexer cleanup another couple of tiny cleanups
2 parents 272000c + b83ea7f commit c7fcbfb

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

src/libsyntax/parse/lexer/mod.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -446,9 +446,7 @@ impl<'a> StringReader<'a> {
446446
self.with_str_from_to(start, self.pos, f)
447447
}
448448

449-
/// Creates a Name from a given offset to the current offset, each
450-
/// adjusted 1 towards each other (assumes that on either side there is a
451-
/// single-byte delimiter).
449+
/// Creates a Name from a given offset to the current offset.
452450
fn name_from(&self, start: BytePos) -> ast::Name {
453451
debug!("taking an ident from {:?} to {:?}", start, self.pos);
454452
self.with_str_from(start, Symbol::intern)
@@ -1420,8 +1418,8 @@ impl<'a> StringReader<'a> {
14201418
// Include the leading `'` in the real identifier, for macro
14211419
// expansion purposes. See #12512 for the gory details of why
14221420
// this is necessary.
1423-
let ident = self.with_str_from(start, |lifetime_name| {
1424-
self.mk_ident(&format!("'{}", lifetime_name))
1421+
let ident = self.with_str_from(start_with_quote, |lifetime_name| {
1422+
self.mk_ident(lifetime_name)
14251423
});
14261424

14271425
if c2.is_numeric() {

src/libsyntax/parse/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ fn char_lit(lit: &str, diag: Option<(Span, &Handler)>) -> (char, isize) {
366366
}
367367

368368
/// Parses a string representing a string literal into its final form. Does unescaping.
369-
pub fn str_lit(lit: &str, diag: Option<(Span, &Handler)>) -> String {
369+
fn str_lit(lit: &str, diag: Option<(Span, &Handler)>) -> String {
370370
debug!("str_lit: given {}", lit.escape_default());
371371
let mut res = String::with_capacity(lit.len());
372372

0 commit comments

Comments
 (0)