2.15 Code Conventions and Style
2.15.1 Formatting
- Use 4 spaces for indentation (by convention).
- Rely on
rustfmt
orcargo fmt
for automated formatting.
2.15.2 Naming Conventions
- Variables/Functions:
snake_case
- Constants/Statics:
SCREAMING_SNAKE_CASE
- Types/Traits/Enums:
PascalCase
- Crates/Modules:
snake_case
2.15.3 Comparison with C
Style varies widely in C. Rust’s community uses a more standardized, tool-enforced convention.