I remember reading somewhere (a post here or a blog) that the suggested way to organize submodules is to place the root of the submodule in module.rs and the rest of the files in the module directory. I.e.,
foo.rs
foo/bar.rs
is better than:
foo/mod.rs
foo/bar.rs
Unfortunately I cannot find that post anymore. The question is if there really is an "official" way to organize submodules (and a rationale) or it is just personal taste?
Note: Prior to rustc 1.30, using 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 within a project.
I disagree with the "official" guidance. Feel free to use whichever one you prefer. In Tokio, we mostly use mod.rs files, since it just makes more sense to have fs-related code inside the tokio/src/fs directory. Having part of the module next to the directory isn't sensible to me.
I would usually agree, but in this case I don't. The two schemes have pros and cons that affect different people/projects in different ways. Moreover, in this case, I don't feel that the cognitive burden is very high: with a little thought and investigation, one could learn about either scheme just by looking at source code. And that's only if you didn't read the Rust docs which explain both.