问题描述
我有一个应用程序分成几个板条箱。我想拒绝或允许所有板条箱中的特定棉绒。例如:
#![deny(clippy::print_stdout)]
看来我必须将它添加到每个板条箱中的 lib.rs 中。
有一个 ticket with Cargo 允许以某种方式配置它,但它已经开放了好几年没有明确的结论。
是否有解决方法可以避免每个板条箱重复这些允许/拒绝/警告行?
我的一个想法是通过在工作区根目录创建一个 include!
来 clippy_config.rs
行,然后在每个 crate 的 lib.rs 添加
include!("../../clippy_config.rs");
但是这失败了
error: an inner attribute is not permitted in this context
--> app/src/../../clippy_config.rs:1:1
|
1 | #![deny(clippy::print_stdout)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: inner attributes,like `#![no_std]`,annotate the item enclosing them,and are usually found at the beginning of source files. Outer attributes,like `#[test]`,annotate the item following them.
出于同样的原因,我的另一个想法是使用宏 also does not work。
除了编写外部脚本来修改 Rust 文件以自动复制之外,是否有一种简单的方法可以做到这一点? (正如前面提到的 in this comment 描述 Embark Studio 的设置)。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)