parameterized
parameterized copied to clipboard
unused import for function used in `#[parametrized]`
Consider this example:
fn foo(s: &str) -> String { format!("foo: {}", s) };
#[cfg(test)]
mod tests {
#[allow(unused_imports)]
// required for usage in #parametrized.
use crate::foo::foo;
use anyhow::Result;
#[parameterized(
input = {
&foo("foo"),
&foo("bar")
}
)
]
fn checks_foo(input: &str) -> Result<()> {
// some assertion
Ok(())
}
}
Here, #[parametrized] obviously uses foo in order to prepare input. However, import of foo function is treated as unused. I do understand that #[parametrized] generates code for test, but is it possible to signal that import is used? Current behaviour confuses me. Please fix this