https://www.reddit.com/r/rust/s/atsLtH1Yf6
レディットではどっちも
好みが分かれてたわ
俺はmod.rsちゃんに慣れすぎて、とりあえずディレクトリ開いたらmod.ra探してた
`name.rs` vs `name/mod.rs` - Is there a reason why projects go against the recommended practice?
There's two ways to declare a nested module in rust:
A
├── name/
└── name.rs
B
└── name/
└── mod.rs
The [Rust Docs](https://doc.rust-lang.org/reference/items/modules.html#module-source-filenames) recommend the first option:
>Prior to rustc 1.30, using [mod.rs](http://mod.rs) files was the way to load a module with nested children. It is encouraged to use the new naming convention as it is more consistent, and avoids having many files named [mod.rs](http://mod.rs) within a project
What I'm wondering is why most Rust projects are still using the [`mod.rs`](http://mod.rs) pattern. I understand some long-standing projects not seeing a compelling reason to change, but even some newer projects still go for [`mod.rs`](http://mod.rs)
I've checked most popular rust projects I know: **ripgrep, burn, candle, ruff, uv, zellij, alacritty, typst, bottom, bevy, spotify-player, yazi.**
Every single one uses `mod.rs`.
Does anybody know if there's a good reason for this?
Rust part35
■ このスレッドは過去ログ倉庫に格納されています
415デフォルトの名無しさん
2026/05/08(金) 12:29:17.61ID:nMekFzvj■ このスレッドは過去ログ倉庫に格納されています