Can Cargo.toml tell Cargo rustc to include plugins?

Let's say I want to flatten all my code with rust. At this point I will have to write

#![feature(plugin)]
#![plugin(clippy)]

      

in each of my sources. Is there any way I can configure Cargo to make rustc use the plugin without adding it to the source file? If so, how?

+3


source to share


2 answers


There is no way to do this using cargo

(without editing the source), but this is definitely what I would like too. The use case I can imagine is that some users want to disallow certain patterns in all dependencies, for example. perhaps an outlaw unsafe

that is not whitelisted, or even go further by requiring anyone to unsafe

be verified .

The compiler has partial support for this in the form rustc -Z extra-plugins=...

, but Cargo doesn't show anything like it yet.



I opened # 1579 .

+5


source


No, you must specify the macro in the source code.



+1


source







All Articles