Search code examples
rust

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


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?


Solution

  • You can use the allow attribute as such:

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

    More on attributes here.