mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-05 20:34:52 +00:00
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.
This commit is contained in:
commit
4530c528ba
@ -630,26 +630,14 @@ impl<'a> StringReader<'a> {
|
|||||||
self.bump();
|
self.bump();
|
||||||
}
|
}
|
||||||
|
|
||||||
if doc_comment {
|
let tok = if doc_comment {
|
||||||
self.with_str_from(start_bpos, |string| {
|
self.with_str_from(start_bpos, |string| {
|
||||||
// comments with only more "/"s are not doc comments
|
|
||||||
let tok = if is_doc_comment(string) {
|
|
||||||
token::DocComment(Symbol::intern(string))
|
token::DocComment(Symbol::intern(string))
|
||||||
|
})
|
||||||
} else {
|
} else {
|
||||||
token::Comment
|
token::Comment
|
||||||
};
|
};
|
||||||
|
Some(TokenAndSpan { tok, sp: self.mk_sp(start_bpos, self.pos) })
|
||||||
Some(TokenAndSpan {
|
|
||||||
tok,
|
|
||||||
sp: self.mk_sp(start_bpos, self.pos),
|
|
||||||
})
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
Some(TokenAndSpan {
|
|
||||||
tok: token::Comment,
|
|
||||||
sp: self.mk_sp(start_bpos, self.pos),
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Some('*') => {
|
Some('*') => {
|
||||||
self.bump();
|
self.bump();
|
||||||
|
Loading…
Reference in New Issue
Block a user