RS.CLIPPY.ITEMS_AFTER_TEST_MODULE

An item was found after the testing module `tests`

This checker is a Clippy lint created by The Rust Project Contributors. The documentation shown here is a copy of the original documentation for: items_after_test_module. Copyright ©2025 The Rust Team. All rights reserved.

What it does

Triggers if an item is declared after the testing module marked with #[cfg(test)].

Why is this bad?

Having items declared after the testing module is confusing and may lead to bad test coverage.

Example

#[cfg(test)]
mod tests {
    // [...]
}

fn my_function() {
    // [...]
}

Use instead:

fn my_function() {
    // [...]
}

#[cfg(test)]
mod tests {
    // [...]
}