Skip to content

Commit

Permalink
properly ignore super::
Browse files Browse the repository at this point in the history
  • Loading branch information
Calsign committed Oct 7, 2023
1 parent a492381 commit 92761c8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions rust_parser/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,8 @@ impl<'ast> AstVisitor<'ast> {
fn add_import<I: Into<Ident<'ast>>>(&mut self, ident: I) {
let ident = ident.into();

if ident == "crate" {
// "crate" is a keyword referring to the current crate; not an import
if ident == "crate" || ident == "super" {
// these are keywords referring to the current crate; not an import
return;
}

Expand Down
2 changes: 2 additions & 0 deletions rust_parser/test_data/simple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ mod foobar {
mod test_inner_mod_2 {}

mod test_inner_mod_3 {}

use super::foobar;
}

use foobar;
Expand Down

0 comments on commit 92761c8

Please sign in to comment.