Eonil
1
The book says,
/tests
/tests/target1.rs
/tests/common/mod.rs
to build a submodule common
for target1
.
And since Rust 2021, mod.rs
is not a recommended practice.
And if I convert it to 2021 edition way,
/tests
/tests/target1.rs
/tests/common.rs
It simply becomes another target.
How am I supposed to make common
submodule without mod.rs
?
Hyeonu
2
You can't. That's the reason why the book said so.
1 Like
vaan
3
You can do it, please have a look this repo for example.
bjorn3
4
There is no clear consensus about which of the two styles to prefer. See also modules: describe both module filename styles without giving a clear preference by RalfJung · Pull Request #1703 · rust-lang/reference · GitHub to reword the reference to not state that one is preferred over the other.