mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 06:44:35 +00:00
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-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-used = use of deprecated attribute `{$name}`: no longer used.
|
||||||
lint-builtin-deprecated-attr-default-suggestion = remove this attribute
|
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) {
|
if is_doc_comment || attr.has_name(sym::doc) {
|
||||||
cx.struct_span_lint(UNUSED_DOC_COMMENTS, span, |lint| {
|
cx.struct_span_lint(UNUSED_DOC_COMMENTS, span, |lint| {
|
||||||
let mut err = lint.build("unused doc comment");
|
let mut err = lint.build(fluent::lint::builtin_unused_doc_comment);
|
||||||
err.span_label(
|
err.set_arg("kind", node_kind);
|
||||||
node_span,
|
err.span_label(node_span, fluent::lint::label);
|
||||||
format!("rustdoc does not generate documentation for {}", node_kind),
|
|
||||||
);
|
|
||||||
match attr.kind {
|
match attr.kind {
|
||||||
AttrKind::DocComment(CommentKind::Line, _) | AttrKind::Normal(..) => {
|
AttrKind::DocComment(CommentKind::Line, _) | AttrKind::Normal(..) => {
|
||||||
err.help("use `//` for a plain comment");
|
err.help(fluent::lint::plain_help);
|
||||||
}
|
}
|
||||||
AttrKind::DocComment(CommentKind::Block, _) => {
|
AttrKind::DocComment(CommentKind::Block, _) => {
|
||||||
err.help("use `/* */` for a plain comment");
|
err.help(fluent::lint::block_help);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
err.emit();
|
err.emit();
|
||||||
|
Loading…
Reference in New Issue
Block a user