Whenever I try to use Bencher
from the test
crate, my IDE reports an error for the not existing crate test
.
The Code snippet is (the allow
clause proved to be useless, #[cfg(test)]
is required for not getting a warning in regular builds)
// required for `Bencher`, see https://doc.rust-lang.org/unstable-book/library-features/test.html
#![feature(test)]
// see https://github.com/rust-lang/rust/issues/21784
#[allow(unresolved_extern_crate)]
#[cfg(test)] extern crate test;
This is how it looks like:
The problem reported is:
unresolved extern crate; rust-analyzer (unresolved-extern-crate)
The code builds and benches fine without a single warning but I cannot get rid of the error in the IDE.
Is there some setting I missed in cargo
, VSCode
, rust-analyzer
?
(toolchain is set to nightly
to have access to the test
-feature)