在Cargo项目中,我可以使用以下命令在src代码上轻松运行clippy:
rustup run nightly cargo clippy但是,如果我使用的是build script,我也想在上面运行clippy。例如,如果我的build.rs文件如下所示:
fn main() {
let foo = "Hello, world!";
println!("{}", foo);
}当我运行clippy时,我希望看到这一点:
warning: use of a blacklisted/placeholder name `foo`, #[warn(blacklisted_name)] on by default
--> build.rs:2:9
|
2 | let foo = "Hello, world!";
| ^^^
|
= help: for further information visit https://github.com/Manishearth/rust-clippy/wiki#blacklisted_name我能想到的在我的构建脚本上运行clippy的唯一方法是将其复制到cargo new临时项目中,运行clippy,在那里进行更改,然后复制回来,但这非常不方便,当build dependencies和类似的东西添加到混合中时,这很快就变得不可行。
有没有更简单的方法来用clippy分析我的构建脚本?
https://stackoverflow.com/questions/41477040
复制相似问题