New inline_test_mod
lint to encouage independent test.rs
files for rebuild performance
#13589
Labels
A-lint
Area: New lints
What it does
Check for
mod test {}
s and instead encourage those being separate files.Checking for
mod test {}
was to align with tests_outside_test_module. I could imagine there being other cases to key off of.Advantage
Rebuild performance. If someone changes a "unit test", then only the test lib rebuilds and not the lib.
Drawbacks
For
foo.rs
files in projects that usefoo/mod.rs
, adding a separate test mod would require creating a directory when it wasn't needed otherwise. Except for when visibility is a concern, a paralleltest_foo.rs
file could be used, e.g. snapbox does thisOverall, this would increase the friction for writing tests.
Example
Could be written as:
The text was updated successfully, but these errors were encountered: