gfx-rs / wgpu

A cross-platform, safe, pure-Rust graphics API.
https://wgpu.rs
Apache License 2.0
12.15k stars 891 forks source link

Enable `clippy::tests_outside_test_module` lint #6106

Open Wumpf opened 1 month ago

Wumpf commented 1 month ago

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

ErichDonGubler commented 1 month ago

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.

Wumpf commented 1 month ago

TIL, thx! then this is a lot less important