Question:I have a Rust project that needs a few binaries with TitleCaseNames. So I created source files like
src/bin/MyBarBinary.rs. The compiler warns that these binary crates should have snake case names, and I want to suppress that warning.
I can add
#![allow(non_snake_case)]to the crate, but that then applies to the crate’s entire contents as well. Not ideal. I really only want to suppress the warning for the crate name. Is that possible?
Answer:I’d suggest to follow the usual
snake_nameconvention for the source file and crate names. Since you need to move the binaries elsewhere during deployment or packaging anyway, you can rename them at that point.
In the nightly compiler build, you can also specify a filename that is different from the crate name in
If you have better answer, please add a comment about this, thank you!