Repository navigation
add directory layout section - #12950
ShahakShama wants to merge 3 commits into
Conversation
Stavbe
left a comment
There was a problem hiding this comment.
@Stavbe made 2 comments.
Reviewable status: 0 of 1 files reviewed, 2 unresolved discussions (waiting on ShahakShama).
style.md line 77 at r1 (raw file):
## Directory Layout Single-file modules use `foo.rs`. Modules with submodules use `foo/mod.rs`.
WDYM by use?
style.md line 87 at r1 (raw file):
For a single-file module `foo.rs`, place tests in `foo_test.rs` in the same directory. Use the `#[path]` attribute to make it a submodule of `foo`:
Do we have an explanation for why do we want this?
77da371 to
0b17fa7
Compare
ShahakShama
left a comment
There was a problem hiding this comment.
@ShahakShama made 2 comments.
Reviewable status: 0 of 1 files reviewed, 2 unresolved discussions (waiting on Stavbe).
style.md line 77 at r1 (raw file):
Previously, Stavbe wrote…
WDYM by use?
Done.
style.md line 87 at r1 (raw file):
Previously, Stavbe wrote…
Do we have an explanation for why do we want this?
This is what we agreed with the goldbergs. If you want we can re-open this
0b17fa7 to
e8dfc47
Compare
Stavbe
left a comment
There was a problem hiding this comment.
@Stavbe made 3 comments.
Reviewable status: 0 of 1 files reviewed, 4 unresolved discussions (waiting on ShahakShama).
style.md line 87 at r1 (raw file):
Previously, ShahakShama wrote…
This is what we agreed with the goldbergs. If you want we can re-open this
Yes, I remember. I just think it is good to add an explanation of the `#[path]' attribute.
style.md line 77 at r2 (raw file):
## Directory Layout Single-file modules should be in a file called `foo.rs`. Modules with submodules should be in a file called `foo/mod.rs`.
<module_name>.rs
Code quote:
foo.rsstyle.md line 79 at r2 (raw file):
Single-file modules should be in a file called `foo.rs`. Modules with submodules should be in a file called `foo/mod.rs`. `mod.rs` should not contain any code — it should only declare submodules.
This contradicts the previous sentence:
Modules with submodules should be in a file called foo/mod.rs
I think you mean that "Modules with submodules should be in a directory called foo that contains a file called mod.ts that contains...
Code quote:
`mod.rs` should not contain any code — it should only declare submodules.e8dfc47 to
eec3e09
Compare
ShahakShama
left a comment
There was a problem hiding this comment.
@ShahakShama made 3 comments.
Reviewable status: 0 of 1 files reviewed, 4 unresolved discussions (waiting on Stavbe).
style.md line 87 at r1 (raw file):
Previously, Stavbe wrote…
Yes, I remember. I just think it is good to add an explanation of the `#[path]' attribute.
added an explanation that this makes the test a submodule and gives private access
style.md line 77 at r2 (raw file):
Previously, Stavbe wrote…
<module_name>.rs
You mean throughout the entire section or here specifically. If throughout I'm ok with this change even though I think it's less better. If only here it will break consistency
style.md line 79 at r2 (raw file):
Previously, Stavbe wrote…
This contradicts the previous sentence:
Modules with submodules should be in a file calledfoo/mod.rs
I think you mean that "Modules with submodules should be in a directory called foo that contains a file called mod.ts that contains...
Yes, that's what I meant, but it's clear that I mean modules with submodules from the fact I wrote mod.rs and not foo.rs
The sentence you wrote is too long IMO. I think this way is clear enough
|
There hasn't been any activity on this pull request recently, and in order to prioritize active work, it has been marked as stale. |

Note
Low Risk
Low risk because changes are documentation-only, but they may influence future code organization conventions across the repo.
Overview
Adds a new Directory Layout section to
style.mdthat standardizes when to usefoo.rsvsfoo/mod.rs, requiresmod.rsto be declaration-only, and documents where to put unit test files (including a#[path]pattern for single-file modules).Removes the prior guideline to avoid
mod.rs, effectively shifting the recommended module layout conventions.Written by Cursor Bugbot for commit e8dfc47. This will update automatically on new commits. Configure here.