This wasn't on google, so I kindly ask someone how to supress this warning:
342 | BAYER_RGGB16,
| ^^^^^^^^^^^^ help: convert the identifier to upper camel case: `BayerRggb16`
#[allow(non_snake_case)]
doesn't work.
rustc has some built-in warnings that enforce standard code style, such as lower-snake-case names for local variables and functions vs. upper-snake-case names for constants and statics. You can turn these off completely by putting #![ allow(nonstandard-style)] in your lib.rs or main.rs .
CamelCase is a way to separate the words in a phrase by making the first letter of each word capitalized and not using spaces. It is commonly used in web URLs, programming and computer naming conventions. It is named after camels because the capital letters resemble the humps on a camel's back.
Meaning of camel case in English. the use of a capital letter to begin the second word in a compound name or phrase, when it is not separated from the first word by a space: Examples of camel case include "iPod" and "GaGa".
Camel case and Pascal case are similar. Both demand variables made from compound words and have the first letter of each appended word written with an uppercase letter. The difference is that Pascal case requires the first letter to be uppercase as well, while camel case does not.
You're looking for the lint option non-camel-case-types
. The description of this check from rustc -W help
reads
name default meaning non-camel-case-types warn types, variants, traits and type parameters should have camel case names
In your snippet, BAYER_RGGB16
appears to be an enum variant, so the default lint options require it to be named in (upper) CamelCase. This check can be disabled with the lint attribute #[allow(non_camel_case_types)]
:
// Can also be applied to the whole enum, instead of just one variant.
// #[allow(non_camel_case_types)]
enum MyEnum {
// ...
#[allow(non_camel_case_types)]
BAYER_RGGB16,
}
Try it yourself on the Rust Playground.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With