Skip to content

Add duplicate_mod lint #8832

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 15, 2022
Merged

Add duplicate_mod lint #8832

merged 1 commit into from
May 15, 2022

Conversation

Alexendoo
Copy link
Member

Inspired by #8827, warns if there's a single file that is loaded by more than one mod item

// lib.rs
mod a;
mod b;
// a.rs
#[path = "./b.rs"]
mod b;

It adds a canonicalize call per mod file; encountered, which I don't think should be too heavy

Integration tests with common modules, e.g. test_utils doesn't trigger it as each test is compiled separately, however I couldn't figure out a good way to add a test for that

changelog: Add [duplicate_mod] lint

@rust-highfive
Copy link

r? @Manishearth

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label May 14, 2022
@Alexendoo Alexendoo changed the title Add duplicate-mod lint Add duplicate_mod lint May 14, 2022
@Manishearth
Copy link
Member

r? @xFrednet

I'm back from the mountains but trying to reduce my pile of notifications rn so cutting down on reviews

@Manishearth
Copy link
Member

@bors r+

actually never mind, this is a pretty straightforward PR 😄

@bors
Copy link
Contributor

bors commented May 15, 2022

📌 Commit 1f79a44 has been approved by Manishearth

@bors
Copy link
Contributor

bors commented May 15, 2022

⌛ Testing commit 1f79a44 with merge c10bfae...

@bors
Copy link
Contributor

bors commented May 15, 2022

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: Manishearth
Pushing c10bfae to master...

@bors bors merged commit c10bfae into rust-lang:master May 15, 2022
@Alexendoo Alexendoo deleted the duplicate-mod branch May 15, 2022 10:03
@SkyfallWasTaken
Copy link

Nice to see that this is finally here!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants