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.
You need to use "rust-analyzer.checkOnSave.overrideCommand": ["cargo", "check", "--bin", "foo", "--features", "bar,qux", "--message-format=json"]. rust-analyzer.checkOnSave.command doesn't accept any arguments.
Sorry for the delay in replying. I've been playing monkey-at-the-keyboard trying to find a combination of settings that works. I finally got it, but I'm afraid to touch anything without some guidance. What should my settings be?
The Rust analyzer settings in my settings.json are
I don't think this problem is related to the one described in this topic, but ...
I've got everything working, but there's one annoyance. Running cargo check from a terminal reports no errors or warnings. Running it in VSCode produces 4 compiler errors and a warning. The code builds and runs correctly in VSCode. I'd like to get rid of those spurious messages. Is there something I need to change in my settings?