fix [empty_docs
] trigger in proc-macro
This commit is contained in:
parent
10677d6901
commit
3cd6fd15a5
@ -14,7 +14,7 @@
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::intravisit::{self, Visitor};
|
||||
use rustc_hir::{AnonConst, Expr};
|
||||
use rustc_lint::{LateContext, LateLintPass};
|
||||
use rustc_lint::{LateContext, LateLintPass, LintContext};
|
||||
use rustc_middle::hir::nested_filter;
|
||||
use rustc_middle::lint::in_external_macro;
|
||||
use rustc_middle::ty;
|
||||
@ -538,7 +538,16 @@ fn fake_broken_link_callback<'a>(_: BrokenLink<'_>) -> Option<(CowStr<'a>, CowSt
|
||||
|
||||
suspicious_doc_comments::check(cx, attrs);
|
||||
|
||||
let (fragments, _) = attrs_to_doc_fragments(attrs.iter().map(|attr| (attr, None)), true);
|
||||
let (fragments, _) = attrs_to_doc_fragments(
|
||||
attrs.iter().filter_map(|attr| {
|
||||
if in_external_macro(cx.sess(), attr.span) {
|
||||
None
|
||||
} else {
|
||||
Some((attr, None))
|
||||
}
|
||||
}),
|
||||
true,
|
||||
);
|
||||
let mut doc = fragments.iter().fold(String::new(), |mut acc, fragment| {
|
||||
add_doc_fragment(&mut acc, fragment);
|
||||
acc
|
||||
|
@ -73,23 +73,5 @@ LL | ///
|
||||
|
|
||||
= help: consider removing or filling it
|
||||
|
||||
error: empty doc comment
|
||||
--> tests/ui/empty_docs.rs:77:5
|
||||
|
|
||||
LL | #[with_empty_docs]
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider removing or filling it
|
||||
= note: this error originates in the attribute macro `with_empty_docs` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: empty doc comment
|
||||
--> tests/ui/empty_docs.rs:82:5
|
||||
|
|
||||
LL | #[with_empty_docs]
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider removing or filling it
|
||||
= note: this error originates in the attribute macro `with_empty_docs` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: aborting due to 11 previous errors
|
||||
error: aborting due to 9 previous errors
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user