Currently, unit tests are registered centrally through mod.rs files:
pub mod read_lease;
#[cfg(test)]
mod read_lease_test;
This pattern requires maintaining test module declarations separately from the source files and causes mod.rs files to accumulate test-related boilerplate.
Refactor unit tests to be co-located with their corresponding source modules using Rust’s inline test module pattern:
// read_lease.rs
#[cfg(test)]
#[path = "read_lease_test.rs"]
mod tests;
Currently, unit tests are registered centrally through mod.rs files:
This pattern requires maintaining test module declarations separately from the source files and causes mod.rs files to accumulate test-related boilerplate.
Refactor unit tests to be co-located with their corresponding source modules using Rust’s inline test module pattern: