Skip to content
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

Rust analyzer incorrectly uses "CamelCase" instead of "PascalCase". #15414

Closed
lindhe opened this issue Aug 8, 2023 · 4 comments
Closed

Rust analyzer incorrectly uses "CamelCase" instead of "PascalCase". #15414

lindhe opened this issue Aug 8, 2023 · 4 comments
Labels
C-bug Category: bug

Comments

@lindhe
Copy link

lindhe commented Aug 8, 2023

The analyzer incorrectly suggest that I shoulod use "CamelCase" for the variants in my Enum. I already use camel case, just not the same variant of camel case as Rust expects. Since the term camel case is not clear about the initial letter, it would be better to use a more well defined term such as "PascalCase" or "UpperCamelCase".

Screenshot from 2023-08-08 14-37-00

Camel case on Wikipedia (bold emphasis is mine):

The format indicates the first word starting with either case, then the following words having an initial uppercase letter.
[…]
The more specific terms Pascal case and upper camel case refer to a joined phrase where the first letter of each word is capitalized, including the initial letter of the first word.

See also this table of examples of letter case on Wikipedia.

rust-analyzer version: (eg. output of "rust-analyzer: Show RA Version" command, accessible in VSCode via Ctrl/⌘+Shift+P)

Mason reports rust-analyzer 2023-08-07.

rustc version: (eg. output of rustc -V)

$ rustc -V                                                                                                       1 ↵
rustc 1.71.1 (eb26296b5 2023-08-03)

relevant settings: (eg. client settings, or environment variables like CARGO, RUSTC, RUSTUP_HOME or CARGO_HOME)

Not sure, nothing I've set explicitly at least. I run NeoVim with rust-lang/rust.vim and rust_analyzer for lspconfig installed via Mason.

@lindhe lindhe added the C-bug Category: bug label Aug 8, 2023
@lindhe
Copy link
Author

lindhe commented Aug 8, 2023

I guess we can discount NeoVim in this equation. I just realized I get the same warning from running cargo check:

Screenshot from 2023-08-08 14-41-05

@tadeokondrak
Copy link
Contributor

See rust-lang/rfcs#2389 for the naming decision for rustc. Is there an error that uses "camel case" when it should use "upper camel case"?

@lindhe
Copy link
Author

lindhe commented Aug 8, 2023

Yeah, looks like I lost that argument five years ago. No reason to keep this open then, until the day I have the time and energy arguing with programming language maintainers. 😕

@lindhe lindhe closed this as completed Aug 8, 2023
@lnicola
Copy link
Member

lnicola commented Aug 8, 2023

Since it might not be obvious, you're seeing the rustc diagnostic, which we don't control. rust-analyzer has its own, inconsistent, diagnostic:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug
Projects
None yet
Development

No branches or pull requests

3 participants