Replies: 1 comment 4 replies
-
|
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have a crate that is a bit funky. It sits in a workspace. The main use case is to use it as a library, therefore it has a lib.rs. But because we needed to write some unit tests, we decided to also enable a CLI-esque functionality via adding a
main.rs
. The problem now is that themain.rs
exists, rust-analyzer thinksmain.rs
has priority overlib.rs
and there is a lot of unused code errors showing. Is there anyway to tell rust analyzer to compile the lib (--lib
in normal cargo) version. I'm using vscode and I've tried this:But it doesn't work. The only other option seems to be the override command but that is a pretty blunt solution.
Edit 1
I just checked the default command
And it indeed just checks the
main.rs
, even if I add--lib
. So it seems this might be a problem with cargo ignoring--lib
when--workspace
is present?Edit 2
I've tried to override the command used by rust-analyzer:
Though this seemed to work at first (giving inlay type hints) I later realized that it does not report the errors. So this approach also does not work.
Beta Was this translation helpful? Give feedback.
All reactions