Change Rust cfg attribute inspection settings

已回答

A recent "feature"  enabled conditional inspection on code depending on cfg blocks: https://github.com/intellij-rust/intellij-rust/issues/1191 and https://blog.jetbrains.com/clion/2019/12/recent-updates-in-rust/ (first section).

How can we change the values of the those cfg variables? Cross-platform development is quite annoying without code inspection, so I'd like to be able to set "target_os".

7
正式评论

You can specify necessary `cfg` options via custom build target in cargo config, i.e. create .cargo/config.toml file and write required build target in `build` table, like

[build]
target = "aarch64-linux-android"

Don't forget to reload project model after changing build target

This would be awesome. Also, is there a work around for this issue? 

1

I don't want to interfere with build process (which cargo config definitely does) and in the same time I need to be able to build for different targets from same sources. So, IDE configuration here would be ideal solution. In my case, I'm building application for different hardware targets (see Ledger Nano series of devices).

1

A simple dialog with ability to specify values for supported variables would be more than enough.

The issue is more than 18 months old, any chances to have it fixed in foreseeable future?

0

请先登录再写评论。