# The module scheme (\`./module.rs\` file + \`./module\` folder instead of just \`./module/mod.rs\`) introduced by the 2018 edition maybe a little bit (more) confusing

**URL:** <https://internals.rust-lang.org/t/the-module-scheme-module-rs-file-module-folder-instead-of-just-module-mod-rs-introduced-by-the-2018-edition-maybe-a-little-bit-more-confusing/21977>\
**Category:** language design\
**Created:** [December 5, 2024, 9:21am UTC](https://internals.rust-lang.org/t/the-module-scheme-module-rs-file-module-folder-instead-of-just-module-mod-rs-introduced-by-the-2018-edition-maybe-a-little-bit-more-confusing/21977 "2024-12-05T09:21:34Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![josh](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/josh/32/5934_2.png) [@josh](https://internals.rust-lang.org/u/josh)\
**Post date:** [December 5, 2024, 5:57pm UTC](https://internals.rust-lang.org/t/the-module-scheme-module-rs-file-module-folder-instead-of-just-module-mod-rs-introduced-by-the-2018-edition-maybe-a-little-bit-more-confusing/21977/6 "2024-12-05T17:57:59Z")

</div>

One of the issues with `module/mod.rs` is that it leads to some confusion when trying to navigate and modify the module hierarchy.

With the `module.rs` approach, you can reliably say that the way to find `a::b::c` is to replace the `::` with `/` and append `.rs`: `a/b/c.rs`. And you can always add a submodule by making a new directory, _without_ having to `git mv a/b/c.rs a/b/c/mod.rs`.

In the absence of `mod.rs`, it's easier to know that whenever you descend a level in the module hierarchy, you descend a directory. You don't have these sideways moves from `mod.rs` to `submodulename.rs`, or unexpected downwards moves to `submodulename/mod.rs`.

There's an exception to that: `main.rs` and `lib.rs` still act in many ways like `mod.rs`, and that can be a source of confusion when projects grow past a single file and begin to modularize. It also causes some confusion in tests.

This isn't an issue when using things like `src/bin/abc.rs` to define an `abc` binary, because submodules of that are `src/bin/abc/xyz.rs`.

Personally, I'm tempted to take that model further: if we moved `bin` and `lib.rs` up a level, we could have:

```plaintext
Cargo.toml
bin/name.rs
bin/name/submod.rs
lib.rs
lib/a.rs
lib/a/x.rs
lib/b.rs
lib/b/y.rs

```

---

_[View the full topic](https://internals.rust-lang.org/t/the-module-scheme-module-rs-file-module-folder-instead-of-just-module-mod-rs-introduced-by-the-2018-edition-maybe-a-little-bit-more-confusing/21977)._
