Skip to content

Incorrect camel case warning #57319

Closed
@tcullum-gpsw

Description

@tcullum-gpsw

Run the following program using Stable or Nightly:

https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=a8e0392ac3ef8c62c5cc66fddabeb564

The compiler tells us:

warning: type `userData` should have a camel case name such as `Userdata`
 --> src/main.rs:1:1
  |
1 | / struct userData
2 | | {
3 | |     name: String,
4 | |     age: u8,
5 | |     weight: f32,
6 | |     height: f32
7 | | }
  | |_^
  |
  = note: #[warn(non_camel_case_types)] on by default

This is incorrect/confusing in 3 ways:

1.) userData is in fact camelCase.

2.) UserData would be PascalCase and this is the convention I've seen

3.) Userdata is neither... So even if for some strange reason we're considering PascalCase as camel case, the recommendation is neither.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions