Skip to content

Commit 4530c52

Browse files
committed
Auto merge of #59700 - matklad:simplify, r=eddyb
Simplify doc comment lexing is_doc_comment function checks the first four chars, but this is redundant, `doc_comment` local var has the same info.
2 parents 72bc620 + 606e0af commit 4530c52

File tree

1 file changed

+5
-17
lines changed
  • src/libsyntax/parse/lexer

1 file changed

+5
-17
lines changed

src/libsyntax/parse/lexer/mod.rs

+5-17
Original file line numberDiff line numberDiff line change
@@ -630,26 +630,14 @@ impl<'a> StringReader<'a> {
630630
self.bump();
631631
}
632632

633-
if doc_comment {
633+
let tok = if doc_comment {
634634
self.with_str_from(start_bpos, |string| {
635-
// comments with only more "/"s are not doc comments
636-
let tok = if is_doc_comment(string) {
637-
token::DocComment(Symbol::intern(string))
638-
} else {
639-
token::Comment
640-
};
641-
642-
Some(TokenAndSpan {
643-
tok,
644-
sp: self.mk_sp(start_bpos, self.pos),
645-
})
635+
token::DocComment(Symbol::intern(string))
646636
})
647637
} else {
648-
Some(TokenAndSpan {
649-
tok: token::Comment,
650-
sp: self.mk_sp(start_bpos, self.pos),
651-
})
652-
}
638+
token::Comment
639+
};
640+
Some(TokenAndSpan { tok, sp: self.mk_sp(start_bpos, self.pos) })
653641
}
654642
Some('*') => {
655643
self.bump();

0 commit comments

Comments
 (0)