rust-lang / rust-lang/rustup

Style: Decide between `foo.rs` and `foo/mod.rs`

Open
#3,883 10 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

  • #3889 by @InfyniteHeap — closed without merging
enhancement
Dominant language
Rust
Stars
7k
Forks
1.1k
Avg merge
22h 40m
Merged PRs (30d)
46

Description

Problem you are trying to solve

It's time to decide between foo.rs and foo/mod.rs. (I'm slightly inclined towards foo.rs.)
by @rami3l in https://github.com/rust-lang/rustup/pull/3882#issue-2356320731

I still find [foo.rs imposing] non-trivial cognitive overhead because it means each module appears twice in the directory tree, and I have to decide which one I need to open.
by @djc in https://github.com/rust-lang/rustup/pull/3882#issuecomment-2172312913

Happy for us to have a discussion then about what style the project should take, but I've found the opposite - foo.rs means the module file path is always the same, whether or not the module has child modules, or is a leaf itself where a directory with just the module file would be tedious.
by @rbtcollins in https://github.com/rust-lang/rustup/pull/3764#issuecomment-2048428811

Solution you'd like

Unify the style of source file organization across the codebase to either one of them, completely eliminating the trace of the other.

Notes

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the existing source tree to identify both module-file styles, then read the discussion in PR 3882 and the linked PR 3764 for the competing trade-offs. The related PR 3889 is also relevant context. Done means the project has one consistently applied source-file organization style with no remaining use of the other.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.