minor: parser cleanup
This commit is contained in:
@@ -183,6 +183,7 @@ fn opt_visibility(p: &mut Parser) -> bool {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
m.complete(p, VISIBILITY);
|
m.complete(p, VISIBILITY);
|
||||||
|
true
|
||||||
}
|
}
|
||||||
// test crate_keyword_vis
|
// test crate_keyword_vis
|
||||||
// crate fn main() { }
|
// crate fn main() { }
|
||||||
@@ -197,10 +198,10 @@ fn opt_visibility(p: &mut Parser) -> bool {
|
|||||||
let m = p.start();
|
let m = p.start();
|
||||||
p.bump(T![crate]);
|
p.bump(T![crate]);
|
||||||
m.complete(p, VISIBILITY);
|
m.complete(p, VISIBILITY);
|
||||||
}
|
|
||||||
_ => return false,
|
|
||||||
}
|
|
||||||
true
|
true
|
||||||
|
}
|
||||||
|
_ => false,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn opt_rename(p: &mut Parser) {
|
fn opt_rename(p: &mut Parser) {
|
||||||
|
|||||||
@@ -135,18 +135,15 @@ pub(super) fn opt_item(p: &mut Parser, m: Marker) -> Result<(), Marker> {
|
|||||||
p.bump_remap(T![default]);
|
p.bump_remap(T![default]);
|
||||||
has_mods = true;
|
has_mods = true;
|
||||||
}
|
}
|
||||||
T![unsafe] => {
|
|
||||||
// test default_unsafe_item
|
// test default_unsafe_item
|
||||||
// default unsafe impl T for Foo {
|
// default unsafe impl T for Foo {
|
||||||
// default unsafe fn foo() {}
|
// default unsafe fn foo() {}
|
||||||
// }
|
// }
|
||||||
if matches!(p.nth(2), T![impl] | T![fn]) {
|
T![unsafe] if matches!(p.nth(2), T![impl] | T![fn]) => {
|
||||||
p.bump_remap(T![default]);
|
p.bump_remap(T![default]);
|
||||||
p.bump(T![unsafe]);
|
p.bump(T![unsafe]);
|
||||||
has_mods = true;
|
has_mods = true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
T![async] => {
|
|
||||||
// test default_async_fn
|
// test default_async_fn
|
||||||
// impl T for Foo {
|
// impl T for Foo {
|
||||||
// default async fn foo() {}
|
// default async fn foo() {}
|
||||||
@@ -156,6 +153,7 @@ pub(super) fn opt_item(p: &mut Parser, m: Marker) -> Result<(), Marker> {
|
|||||||
// impl T for Foo {
|
// impl T for Foo {
|
||||||
// default async unsafe fn foo() {}
|
// default async unsafe fn foo() {}
|
||||||
// }
|
// }
|
||||||
|
T![async] => {
|
||||||
let mut maybe_fn = p.nth(2);
|
let mut maybe_fn = p.nth(2);
|
||||||
let is_unsafe = if matches!(maybe_fn, T![unsafe]) {
|
let is_unsafe = if matches!(maybe_fn, T![unsafe]) {
|
||||||
maybe_fn = p.nth(3);
|
maybe_fn = p.nth(3);
|
||||||
|
|||||||
Reference in New Issue
Block a user