我把一份申请分为几箱。我想拒绝或允许在所有板条箱中使用特定的线头。例如:
#![deny(clippy::print_stdout)]
看来我得把这个加到lib里。每个板条箱里都有一个箱子。
有一个
ticket with Cargo
以某种方式允许配置,但它已经开放了几年,没有明确的结论。
是否有一个解决方法来避免每个板条箱重复这些允许/拒绝/警告行?
我的一个想法是
include!
通过创建
clippy_config.rs
在工作区根目录下,然后在每个板条箱的库中。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
描述登船工作室的设置)。