-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Ferris 🦀 Identifier naming conventions #137356
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @fmease (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 (
|
This comment has been minimized.
This comment has been minimized.
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'm tempted to say that this fix is a bit overkill for what amounts to an easter-egg in the compiler. Please at least fix the approach, remove the stray flake file, and squash all the commits into one though.
ca69dc2
to
7df0af0
Compare
test: add tests for correct ferris capitalization fix: add "struct" style: use rustfmt style: remove newline fix: _ _ _ _ _
@bors r+ rollup |
enum FerrisFix { | ||
SnakeCase, | ||
ScreamingSnakeCase, | ||
PascalCase, | ||
} | ||
|
||
impl FerrisFix { | ||
const fn as_str(self) -> &'static str { | ||
match self { | ||
FerrisFix::SnakeCase => "ferris", | ||
FerrisFix::ScreamingSnakeCase => "FERRIS", | ||
FerrisFix::PascalCase => "Ferris", | ||
} | ||
} | ||
} |
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 doesn't really need to be an enum, it's used for a single purpose so constants would have been fine and more compact. Or even literals considering SnakeCase
and PascalCase
are each constructed once and ScreamingSnakeCase
only twice.
(but already approved so 🤷 )
Ferris 🦀 Identifier naming conventions You cannot use Ferris as an identifier in Rust, this code will suggest to correct the 🦀 to `ferris`: ```rs fn main() { let 🦀 = 4; } ``` But it also suggests to correct to `ferris` in these cases, too: ```rs struct 🦀 {} fn main() {} ``` ^ suggests: `ferris` ~ with this PR: `Ferris` ```rs static 🦀: &str = "ferris!"; fn main() {} ``` ^ suggests: `ferris` ~ with this PR: `FERRIS` This is my first pull requests here!
…mpiler-errors Rollup of 10 pull requests Successful merges: - rust-lang#136642 (Put the alloc unit tests in a separate alloctests package) - rust-lang#136910 (Implement feature `isolate_most_least_significant_one` for integer types) - rust-lang#137183 (Prune dead regionck code) - rust-lang#137333 (Use `edition = "2024"` in the compiler (redux)) - rust-lang#137356 (Ferris 🦀 Identifier naming conventions) - rust-lang#137362 (Add build step log for `run-make-support`) - rust-lang#137377 (Always allow reusing cratenum in CrateLoader::load) - rust-lang#137388 (Fix(lib/fs/tests): Disable rename POSIX semantics FS tests under Windows 7) - rust-lang#137410 (Use StableHasher + Hash64 for dep_tracking_hash) - rust-lang#137413 (jubilee cleared out the review queue) r? `@ghost` `@rustbot` modify labels: rollup
…iaskrgr Rollup of 9 pull requests Successful merges: - rust-lang#136910 (Implement feature `isolate_most_least_significant_one` for integer types) - rust-lang#137183 (Prune dead regionck code) - rust-lang#137333 (Use `edition = "2024"` in the compiler (redux)) - rust-lang#137356 (Ferris 🦀 Identifier naming conventions) - rust-lang#137362 (Add build step log for `run-make-support`) - rust-lang#137377 (Always allow reusing cratenum in CrateLoader::load) - rust-lang#137388 (Fix(lib/fs/tests): Disable rename POSIX semantics FS tests under Windows 7) - rust-lang#137410 (Use StableHasher + Hash64 for dep_tracking_hash) - rust-lang#137413 (jubilee cleared out the review queue) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#137356 - nik-rev:FERRIS, r=compiler-errors Ferris 🦀 Identifier naming conventions You cannot use Ferris as an identifier in Rust, this code will suggest to correct the 🦀 to `ferris`: ```rs fn main() { let 🦀 = 4; } ``` But it also suggests to correct to `ferris` in these cases, too: ```rs struct 🦀 {} fn main() {} ``` ^ suggests: `ferris` ~ with this PR: `Ferris` ```rs static 🦀: &str = "ferris!"; fn main() {} ``` ^ suggests: `ferris` ~ with this PR: `FERRIS` This is my first pull requests here!
You cannot use Ferris as an identifier in Rust, this code will suggest to correct the 🦀 to
ferris
:But it also suggests to correct to
ferris
in these cases, too:^ suggests:
ferris
~ with this PR:
Ferris
^ suggests:
ferris
~ with this PR:
FERRIS
This is my first pull requests here!