mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 22:01:37 +00:00
Fix and test edge cases of _
as ident
This commit is contained in:
parent
0a0e22235b
commit
0a7f28620a
3 changed files with 13 additions and 3 deletions
|
@ -49,6 +49,13 @@ impl<'a> TtIter<'a> {
|
|||
}
|
||||
|
||||
pub(crate) fn expect_ident(&mut self) -> Result<&'a tt::Ident, ()> {
|
||||
match self.expect_leaf()? {
|
||||
tt::Leaf::Ident(it) if it.text != "_" => Ok(it),
|
||||
_ => Err(()),
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn expect_ident_or_underscore(&mut self) -> Result<&'a tt::Ident, ()> {
|
||||
match self.expect_leaf()? {
|
||||
tt::Leaf::Ident(it) => Ok(it),
|
||||
_ => Err(()),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue