I am trying to get cargo check working with the rust analyzer in VSCode and conditional compilation. I planted an error that shows up when I build but not when check runs on save. Check does report warnings and an error in code that should not be part of the compilation.
#[cfg(feature="bar")]
println!("{}");
Running cargo
cargo check --bin foo --features "bar,qux"
from the console does report the error.
VSCode Settings has
Rust-analyzer > Check On Save: Command
check --bin foo --features "bar,qux"