Guideline: Rust Style
16 points by itamarst
16 points by itamarst
Ed Page is one of the Rust treasures who I'm moderately convinced isn't actually human and is some other far more efficient and productive life form.
The only real one that catches my eye here is:
Prefer mod.rs over name.rs
Which while I don't disagree with the reasoning given, I find it annoying when I'm grepping for something and I see 40 mod.rs results if my file picker isn't configured (or can't be configured) to show parent directory as well.
I prefer name.rs over name/mod.rs even knowing the reasons outlined here. They work significantly better in vscode (which is the primary target for rust-analyzer) and other tooling that expects unique filenames.
I prefer imports grouped by module rather than individually as this is a reasonable size that usually fits pretty well. My comparisons for this preference come from evaluating this in Ratatui (which uses grouped by module) vs Codex (where it's a line per individual import). I've found that the merge conflicts are rare in both approaches, and that individual imports add visual noise when reading and writing code that has to be scrolled past (yes you can collapse this, in some places, but you shouldn't have to). It's a small but annoying paper cut that happens on every file open, while a merge conflict happens much less frequently.
https://epage.github.io/dev/rust-style/#m-caller-callee is something I have super strong agreement with and I think it's probably the one that I'd call out as the most important . The rest also feel like I'm in alignment with.