How to make submodules in integration test without mod.rs?

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?

You can't. That's the reason why the book said so.

1 Like

You can do it, please have a look this repo for example.

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.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.