Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there some way to not show a warning for non snake case identifiers?

Tags:

I'm writing my first tests in Rust and I find this:

warning: function testCall should have a snake case name such as test_call, #[warn(non_snake_case)] on by default

after searching, I found this style guide.

I understand it is a convention, but is there some way to not show this warning?

like image 425
Angel Angel Avatar asked Mar 31 '16 21:03

Angel Angel


People also ask

How do I turn off Snake Case warning rust?

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 .

Does rust use camel case or snake case?

There is a method in the Rust convention: Structs get camel case. Variables get snake case. Constants get all upper case.

What is Snake_case naming style?

Snake case (stylized as snake_case) refers to the style of writing in which each space is replaced by an underscore (_) character, and the first letter of each word is written in lowercase. It is a commonly used naming convention in computing, for example for variable and subroutine names, and for filenames.


1 Answers

You can use the allow attribute as such:

#[allow(non_snake_case)] fn nonSnakeCase() {} 

More on attributes here.

like image 154
squiguy Avatar answered Sep 18 '22 16:09

squiguy