-
Notifications
You must be signed in to change notification settings - Fork 13.9k
Description
Hi!
I got unexpected dead code warnings when executing cargo test with multiple test files. I use a very simple example below that reproduces the issue.
I have two files that contains tests, tests/test_one.rs and tests/test_two.rs. Both contains exactly the same content (except for the unique test function name they contain):
mod routines;
#[test]
fn test_one() {
routines::my_routine();
}And another file called tests/routines.rs that simply contains:
pub fn my_routine() {
}When I execute cargo test, the two tests are executed successfully and there is no raised warning. But if I remove the my_routine() call from one of the two tests, cargo test stills end up successfully but raises a warning on pub fn routine() saying function is never used. However, one test still calls the function, so there is no dead code as stated.
I got the same issue with both rust stable (1.22.1) and rust nightly (1.24.0).
Thanks.