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.rs12
1 files changed, 3 insertions, 9 deletions
diff --git a/crates/parser/src/grammar/items.rs b/crates/parser/src/grammar/items.rs
index 7d98499008..8ece5af527 100644
--- a/crates/parser/src/grammar/items.rs
+++ b/crates/parser/src/grammar/items.rs
@@ -254,22 +254,16 @@ fn opt_item_without_modifiers(p: &mut Parser<'_>, m: Marker) -> Result<(), Marke
// test extern_crate
// extern crate foo;
+// extern crate self;
fn extern_crate(p: &mut Parser<'_>, m: Marker) {
p.bump(T![extern]);
p.bump(T![crate]);
- if p.at(T![self]) {
- // test extern_crate_self
- // extern crate self;
- let m = p.start();
- p.bump(T![self]);
- m.complete(p, NAME_REF);
- } else {
- name_ref(p);
- }
+ name_ref_or_self(p);
// test extern_crate_rename
// extern crate foo as bar;
+ // extern crate self as bar;
opt_rename(p);
p.expect(T![;]);
m.complete(p, EXTERN_CRATE);