mirror of
https://gitee.com/openharmony/third_party_rust_syn
synced 2024-11-23 16:00:10 +00:00
Simplify Cursor::lifetime using a question mark
This commit is contained in:
parent
502968cc68
commit
65ee83a0ad
@ -261,16 +261,12 @@ impl<'a> Cursor<'a> {
|
||||
match self.entry() {
|
||||
Entry::Punct(punct) if punct.as_char() == '\'' && punct.spacing() == Spacing::Joint => {
|
||||
let next = unsafe { self.bump_ignore_group() };
|
||||
match next.ident() {
|
||||
Some((ident, rest)) => {
|
||||
let lifetime = Lifetime {
|
||||
apostrophe: punct.span(),
|
||||
ident,
|
||||
};
|
||||
Some((lifetime, rest))
|
||||
}
|
||||
None => None,
|
||||
}
|
||||
let (ident, rest) = next.ident()?;
|
||||
let lifetime = Lifetime {
|
||||
apostrophe: punct.span(),
|
||||
ident,
|
||||
};
|
||||
Some((lifetime, rest))
|
||||
}
|
||||
_ => None,
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user