I am running into an unexpected issue when it comes to toolchains in CLion. I want to use the stable channel for the compiler while using the nightly for rustfmt. The reason is that I want to use rustfmt features that are not available in the stable version. Unfortunately CLion only picks up the currently selected toolchain without any way to override or customize this and thus has not option to select the nightly of rustfmt for formatting. Is there any workaround or option I did not notice when looking for it?
In the comment there was the suggestion that cargo +nightly fmt
might be what I am looking for. Even though it allows to used the nightly of rustfmt it is not integrated into the flow of CLion which seems to use the currently enabled version of the entire toolchain.
Under Clion | Preferences...
:
formatter
Rustfmt
on the left column+nightly
to the Additional arguments:
boxUse rustfmt instead of the built-in formatter
Ok
Now Code | Reformat File with rustfmt
should respect rustfmt
nightly settings. (CLion 2022.2.4)