mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-13 13:48:50 +00:00
minor: parser cleanup
This commit is contained in:
parent
c72a30af63
commit
ec2043a082
2 changed files with 20 additions and 21 deletions
|
@ -183,6 +183,7 @@ fn opt_visibility(p: &mut Parser) -> bool {
|
|||
}
|
||||
}
|
||||
m.complete(p, VISIBILITY);
|
||||
true
|
||||
}
|
||||
// test crate_keyword_vis
|
||||
// crate fn main() { }
|
||||
|
@ -197,10 +198,10 @@ fn opt_visibility(p: &mut Parser) -> bool {
|
|||
let m = p.start();
|
||||
p.bump(T![crate]);
|
||||
m.complete(p, VISIBILITY);
|
||||
true
|
||||
}
|
||||
_ => return false,
|
||||
_ => false,
|
||||
}
|
||||
true
|
||||
}
|
||||
|
||||
fn opt_rename(p: &mut Parser) {
|
||||
|
|
|
@ -135,27 +135,25 @@ pub(super) fn opt_item(p: &mut Parser, m: Marker) -> Result<(), Marker> {
|
|||
p.bump_remap(T![default]);
|
||||
has_mods = true;
|
||||
}
|
||||
T![unsafe] => {
|
||||
// test default_unsafe_item
|
||||
// default unsafe impl T for Foo {
|
||||
// default unsafe fn foo() {}
|
||||
// }
|
||||
if matches!(p.nth(2), T![impl] | T![fn]) {
|
||||
p.bump_remap(T![default]);
|
||||
p.bump(T![unsafe]);
|
||||
has_mods = true;
|
||||
}
|
||||
// test default_unsafe_item
|
||||
// default unsafe impl T for Foo {
|
||||
// default unsafe fn foo() {}
|
||||
// }
|
||||
T![unsafe] if matches!(p.nth(2), T![impl] | T![fn]) => {
|
||||
p.bump_remap(T![default]);
|
||||
p.bump(T![unsafe]);
|
||||
has_mods = true;
|
||||
}
|
||||
T![async] => {
|
||||
// test default_async_fn
|
||||
// impl T for Foo {
|
||||
// default async fn foo() {}
|
||||
// }
|
||||
// test default_async_fn
|
||||
// impl T for Foo {
|
||||
// default async fn foo() {}
|
||||
// }
|
||||
|
||||
// test default_async_unsafe_fn
|
||||
// impl T for Foo {
|
||||
// default async unsafe fn foo() {}
|
||||
// }
|
||||
// test default_async_unsafe_fn
|
||||
// impl T for Foo {
|
||||
// default async unsafe fn foo() {}
|
||||
// }
|
||||
T![async] => {
|
||||
let mut maybe_fn = p.nth(2);
|
||||
let is_unsafe = if matches!(maybe_fn, T![unsafe]) {
|
||||
maybe_fn = p.nth(3);
|
||||
|
|
Loading…
Reference in a new issue