google / google/comprehensive-rust

Introduce fmt and clippy early on as "recommended practices"

Open
#1,725 2 comments 1 reaction 0 assignees View on GitHub
Dominant language
Rust
Stars
33.4k
Forks
2.1k
Avg merge
1d 3h
Merged PRs (30d)
10

Description

Having taught Rust multiple classes plus advising substantial number of projects, I noticed many, especially C++ developers undervalue the importance of `cargo fmt`, compiler warnings, and clippy warnings.

I think it would be good to introduce good "Rust hygiene" practices early on, and make sure to stress the importance of them.

Important points:
* most Rust projects standardize on `cargo fmt`, and Rust developers expect the code to follow the same rules
* automate `fmt` on save (available in both VS Code and IntelliJ)
* don't fight `cargo fmt` - if unhappy with the results, insert additional variables/statements to keep code easier to read
* don't ignore compiler warnings - they hide bugs. Use `#[allow(...)]` in the few edge cases.
* use `cargo clippy` to improve you Rust-foo.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.