-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
move modules from kebab-case to snake_case #14439
base: master
Are you sure you want to change the base?
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @ehuss (or someone else) some time within the next two weeks. Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (
|
src/doc/src/guide/project-layout.md
Outdated
│ ├── named_executable.rs | ||
│ ├── another_executable.rs | ||
│ └── multi_file_executable/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this would have end-user affects, making the default binary names use _
when the status quo is for binaries to use -
.
As these are not just mod
names but build target names, i would be inclined to leave all of these as -
Thanks for the PR! I think there may be some confusion, as these filenames do not represent crate names, they are target names. Considering that there isn't a standard for how those should be named, I'm disinclined to change these here. Indeed, cargo's own repository makes use of hyphen in most places. |
Should we call that out in this page then? I am happy with |
I have tried to add some clarity by explicitly stating my current understanding here. What do you think? One thing I debated was if using a single word for targets should be recommended but that does not feel right. |
@@ -48,6 +48,8 @@ files, place a `main.rs` file along with the extra [*modules*][def-module] | |||
within a subdirectory of the `src/bin`, `examples`, `benches`, or `tests` | |||
directory. The name of the executable will be the directory name. | |||
|
|||
Binaries, examples, benches and integration tests follow `kebab-case` naming style. Modules within those targets are `snake_case` following the [Rust standard](https://rust-lang.github.io/rfcs/0430-finalizing-naming-conventions.html). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is likely best left to a style guide, with us finding an appropriate place to link out to it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a style guide that makes sense to use?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The way I see it, right now no one in the rust ecosystem directly says that build targets are kebab-case
. This document is the closest but it is not clear.
Are cargo targets a cargo concept? If so can we define the naming convention somewhere here in the cargo docs that says those targets should be |
What does this PR try to resolve?
It is currently unclear reading the docs how files should be named. RFC 430 is clear on crates and module names,
kebab-case
is never mentioned and while there are historical considerations, we should guide new development towardssnake_case
. We should align the documented defaults to that RFC.How should we test and review this PR?
Review the docs and determine if we view value in the change.