Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/parser/src/grammar/items.rs')
-rw-r--r--crates/parser/src/grammar/items.rs36
1 files changed, 17 insertions, 19 deletions
diff --git a/crates/parser/src/grammar/items.rs b/crates/parser/src/grammar/items.rs
index e0b740a815..5fdffc4f96 100644
--- a/crates/parser/src/grammar/items.rs
+++ b/crates/parser/src/grammar/items.rs
@@ -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;
}
+ // 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() {}
+ // }
T![async] => {
- // 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() {}
- // }
let mut maybe_fn = p.nth(2);
let is_unsafe = if matches!(maybe_fn, T![unsafe]) {
maybe_fn = p.nth(3);