reference icon indicating copy to clipboard operation
reference copied to clipboard

Revise advice about which naming convention to use for modules

Open ssokolow opened this issue 3 years ago • 2 comments

It seems people are interpreting this line in the Modules page of the reference...

It is encouraged to use the new naming convention as it is more consistent, and avoids having many files named mod.rs within a project.

...to mean that the mod.rs approach to laying out a project on disk is deprecated, which is at odds with this line from RFC 2126.

The use of mod.rs continues to be allowed without any deprecation. It is expected that tooling like Clippy will push for at least style consistency within a project, and perhaps eventually across the ecosystem.

It also refers to the new convention as "more consistent" when, without going into the RFC an enumerating the bullet points, moving away from having all the .rs files within a single folder feels differently consistent, not more so.

Please consider adjusting the phrasing to make it more clear that this is not an official statement of policy but merely a piece of advice.

Perhaps something along the lines of this:

If you are uncertain which convention to follow, we recommend using the new naming convention as it simplifies the addition of new submodules as your project grows and makes it easier for your editor to display unambiguous names for open files.

ssokolow avatar May 11 '22 06:05 ssokolow

Yea, I think that note is worded a little too strongly. But I wouldn't say it implies that the other form is deprecated, just that it is encouraged to use the new one. And there was desire at the time to push towards making that the default/dominant style, but that fizzled out a bit.

I'd be inclined to just remove the note, and defer style issues elsewhere.

ehuss avatar May 11 '22 20:05 ehuss

But I wouldn't say it implies that the other form is deprecated

I didn't see it that way either, but I saw a lot of people on /r/rust interpreting it that way.

ssokolow avatar May 11 '22 21:05 ssokolow