Soft question: underscore in names

Naming conventions are one of those topics that people start religious wars over, and starting your comment with such strong wording means the @moderators will need to follow this thread closely to prevent it from devolving into arguments over naming.

Whether you agree with the chosen conventions or not, Rust's naming conventions are consistent and have been codified in RFC 430.

Different "kinds" of names are only valid in different contexts (types can't be used as values, module paths often contain :: can't be used as types, static/const are typically globals, etc.) and we use naming conventions so you can see at a glance what they are, with things that are generally interchangeable being named similarly (crates and module paths, functions and locals, type parameters and types and traits, etc.).

Item Convention
Crates snake_case (but prefer single word)
Modules snake_case
Types UpperCamelCase
Traits UpperCamelCase
Enum variants UpperCamelCase
Functions snake_case
Methods snake_case
General constructors new or with_more_details
Conversion constructors from_some_other_type
Local variables snake_case
Static variables SCREAMING_SNAKE_CASE
Constant variables SCREAMING_SNAKE_CASE
Type parameters concise UpperCamelCase, usually single uppercase letter: T
Lifetimes short, lowercase: 'a
15 Likes