wgpu icon indicating copy to clipboard operation
wgpu copied to clipboard

Enable `clippy::tests_outside_test_module` lint

Open Wumpf opened this issue 1 year ago • 2 comments

There's a whole bunch of tests that aren't in test modules. This should be solved once and for all using this clippy lint https://rust-lang.github.io/rust-clippy/master/index.html#/tests_outside_test_module

Not doing so means that the tests will be unnecessarily compiled as part of non test builds

Wumpf avatar Aug 12 '24 12:08 Wumpf

Not doing so means that the tests will be unnecessarily compiled as part of non test builds

AFAIK, this is incorrect, because #[test] implies #[cfg(test)]; according to the Testing page in the Rust Reference](https://doc.rust-lang.org/reference/attributes/testing.html):

The test attribute marks a function to be executed as a test. These functions are only compiled when in test mode.

Test helpers and other things that aren't marked as cfg(test) are certainly a risk, but AFAIK our CI will catch those by denying warnings on build.

ErichDonGubler avatar Aug 12 '24 12:08 ErichDonGubler

TIL, thx! then this is a lot less important

Wumpf avatar Aug 12 '24 14:08 Wumpf