Skip to content

refactor: Get rid of mod.rs files#998

Merged
netrome merged 2 commits intomainfrom
996-get-rid-of-modrs-files
Sep 3, 2025
Merged

refactor: Get rid of mod.rs files#998
netrome merged 2 commits intomainfrom
996-get-rid-of-modrs-files

Conversation

@netrome
Copy link
Copy Markdown
Collaborator

@netrome netrome commented Sep 3, 2025

closes #996

Note: This is a matter of personal preference. If anyone has conflicting opinions of this, don't hesitate to speak up.

@netrome netrome linked an issue Sep 3, 2025 that may be closed by this pull request
@netrome netrome requested a review from Copilot September 3, 2025 07:46

This comment was marked as outdated.

Copy link
Copy Markdown
Contributor

@gilcu3 gilcu3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very hard to not approve (given that the compiler says it is fine)

@netrome netrome enabled auto-merge September 3, 2025 07:47
Copy link
Copy Markdown
Contributor

@DSharifi DSharifi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

Could you please enforce this clippy lint as part of the PR? clippy::mod_module_files

@netrome netrome disabled auto-merge September 3, 2025 08:01
@netrome
Copy link
Copy Markdown
Collaborator Author

netrome commented Sep 3, 2025

Thank you!

Could you please enforce this clippy lint as part of the PR? clippy::mod_module_files

Done in 7764233

@netrome netrome requested review from DSharifi and Copilot September 3, 2025 08:08
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the codebase to eliminate mod.rs files by adding the #![deny(clippy::mod_module_files)] lint to enforce using module file names instead of mod.rs files.

  • Adds clippy lint to prevent mod.rs usage across all library entry points
  • Enforces consistent module organization using individual module files

Reviewed Changes

Copilot reviewed 7 out of 23 changed files in this pull request and generated no comments.

Show a summary per file
File Description
node/src/lib.rs Adds clippy lint to deny mod.rs files
libs/chain-signatures/contract/src/lib.rs Adds clippy lint to deny mod.rs files
crates/tls/src/lib.rs Adds clippy lint to deny mod.rs files
crates/test_utils/src/lib.rs Adds clippy lint to deny mod.rs files
crates/tee_authority/src/lib.rs Adds clippy lint to deny mod.rs files
crates/primitives/src/lib.rs Adds clippy lint to deny mod.rs files
crates/attestation/src/lib.rs Adds clippy lint to deny mod.rs files

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link
Copy Markdown
Contributor

@DSharifi DSharifi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks.

Just a tip, we alternatively add the the lint to the workspaceCargo.toml file instead of in the source code

[workspace.lints.clippy]
mod_module_files = "forbid"

And inheritance to the workspace members's Cargo.toml files:

[lints]
workspace = true

It's unfortunate that the explicit workspace inheritance is needed for the lints though. There's a tracking issue for automatically inheriting the lints:
rust-lang/cargo#12208

@netrome netrome force-pushed the 996-get-rid-of-modrs-files branch from 7764233 to 308c39f Compare September 3, 2025 09:56
@netrome
Copy link
Copy Markdown
Collaborator Author

netrome commented Sep 3, 2025

Thanks.

Just a tip, we alternatively add the the lint to the workspaceCargo.toml file instead of in the source code

[workspace.lints.clippy]
mod_module_files = "forbid"

And inheritance to the workspace members's Cargo.toml files:

[lints]
workspace = true

It's unfortunate that the explicit workspace inheritance is needed for the lints though. There's a tracking issue for automatically inheriting the lints: rust-lang/cargo#12208

Right, nice. Updated this in 308c39f

@netrome netrome force-pushed the 996-get-rid-of-modrs-files branch from 308c39f to 9748f1a Compare September 3, 2025 11:39
@netrome
Copy link
Copy Markdown
Collaborator Author

netrome commented Sep 3, 2025

Right, nice. Updated this in 308c39f

This caused some clippy errors in the Devnet crate. Probably worth fixing it, but in the interest of not getting stuck on this I reverted and restored the old top level attributes to enforce the lint.

@netrome netrome force-pushed the 996-get-rid-of-modrs-files branch from 9748f1a to a02b15e Compare September 3, 2025 11:41
@netrome netrome enabled auto-merge September 3, 2025 11:41
@netrome netrome added this pull request to the merge queue Sep 3, 2025
@DSharifi
Copy link
Copy Markdown
Contributor

DSharifi commented Sep 3, 2025

Right, nice. Updated this in 308c39f

This caused some clippy errors in the Devnet crate. Probably worth fixing it, but in the interest of not getting stuck on this I reverted and restored the old top level attributes to enforce the lint.

Makes sense. Thanks for trying :)

Created #1005 so we can revisit in the future.

Merged via the queue into main with commit e8a5d43 Sep 3, 2025
12 checks passed
@netrome netrome deleted the 996-get-rid-of-modrs-files branch September 3, 2025 12:30
@netrome netrome self-assigned this Sep 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Get rid of mod.rs files

5 participants