lint: port unused doc comment diagnostics
Signed-off-by: David Wood <david.wood@huawei.com>
This commit is contained in:
parent
e151d66343
commit
a13b70ea83
@ -338,3 +338,8 @@ lint-builtin-anonymous-params = anonymous parameters are deprecated and will be
|
||||
lint-builtin-deprecated-attr-link = use of deprecated attribute `{$name}`: {$reason}. See {$link}
|
||||
lint-builtin-deprecated-attr-used = use of deprecated attribute `{$name}`: no longer used.
|
||||
lint-builtin-deprecated-attr-default-suggestion = remove this attribute
|
||||
|
||||
lint-builtin-unused-doc-comment = unused doc comment
|
||||
.label = rustdoc does not generate documentation for {$kind}
|
||||
.plain-help = use `//` for a plain comment
|
||||
.block-help = use `/* */` for a plain comment
|
||||
|
@ -1039,17 +1039,15 @@ fn warn_if_doc(cx: &EarlyContext<'_>, node_span: Span, node_kind: &str, attrs: &
|
||||
|
||||
if is_doc_comment || attr.has_name(sym::doc) {
|
||||
cx.struct_span_lint(UNUSED_DOC_COMMENTS, span, |lint| {
|
||||
let mut err = lint.build("unused doc comment");
|
||||
err.span_label(
|
||||
node_span,
|
||||
format!("rustdoc does not generate documentation for {}", node_kind),
|
||||
);
|
||||
let mut err = lint.build(fluent::lint::builtin_unused_doc_comment);
|
||||
err.set_arg("kind", node_kind);
|
||||
err.span_label(node_span, fluent::lint::label);
|
||||
match attr.kind {
|
||||
AttrKind::DocComment(CommentKind::Line, _) | AttrKind::Normal(..) => {
|
||||
err.help("use `//` for a plain comment");
|
||||
err.help(fluent::lint::plain_help);
|
||||
}
|
||||
AttrKind::DocComment(CommentKind::Block, _) => {
|
||||
err.help("use `/* */` for a plain comment");
|
||||
err.help(fluent::lint::block_help);
|
||||
}
|
||||
}
|
||||
err.emit();
|
||||
|
Loading…
Reference in New Issue
Block a user