我使用pest解析器来解析我的输入,但是它总是给我两个“缺少文档”警告:
#[allow(missing_copy_implementations, missing_docs)]
#[derive(Parser, Debug, Clone)]
#[grammar = "grammar.pest"]
pub struct MyParser;导致:
warning: missing documentation for an enum
--> src/lib.rs:76:10
|
76 | #[derive(Parser, Debug, Clone)]
| ^^^^^^
|
note: the lint level is defined here
--> src/lib.rs:7:5
|
7 | missing_docs,
| ^^^^^^^^^^^^
= note: this warning originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
warning: missing documentation for a variant
--> src/lib.rs:76:10
|
76 | #[derive(Parser, Debug, Clone)]
| ^^^^^^
|
= note: this warning originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
warning: 2 warnings emitted我怎么才能解决呢?只有结构应该有文档,枚举应该是私有的。
发布于 2021-12-30 03:58:19
派生宏可以在生成新类型时选择复制属性--因此理论上,Pest可以将您的#[allow(missing_docs)]指令复制到它正在生成的枚举中(或者复制文档本身)。如果没有Pest添加此功能,您唯一可以阻止此警告的方法是将#![allow(missing_docs)]放在文件的顶部。
https://stackoverflow.com/questions/66855787
复制相似问题