I have test_utils in a module and I want to use those in tests across the different submodules. Although I use them in the testing, whenver I compile the code the it shows warnning regarding not used functions. Is there a place where I can put them and not having those warnings? or should I just use #[allow(dead_code)]
To illustrate, I have test_utils.rs
storage/test_utils.rs
pub const TEST_DIR: &str = "/tmp/test-rkv";
use std::fs;
pub fn setup() {
fs::create_dir_all("/tmp/test").unwrap();
}
And I use that method in storage/data.rs
#[cfg(test)]
mod tests {
use storage::test_utils::setup;
#[test]
fn sample() {
setup();
}
warning: function is never used: `setup`
--> src/storage/test_utils.rs:10:1
|
10 | fn setup() {
| ^^^^^^^^^^
|
= note: #[warn(dead_code)] on by default