Skip to content

Commit 3ce3569

Browse files
committed
optimise code for readability
1 parent 5b0122b commit 3ce3569

File tree

1 file changed

+11
-14
lines changed

1 file changed

+11
-14
lines changed

clippy_lints/src/empty_docs.rs

+11-14
Original file line numberDiff line numberDiff line change
@@ -41,20 +41,17 @@ fn trim_comment(comment: &str) -> String {
4141

4242
impl EarlyLintPass for EmptyDocs {
4343
fn check_attribute(&mut self, cx: &EarlyContext<'_>, attribute: &Attribute) {
44-
match attribute.kind {
45-
AttrKind::DocComment(_line, comment) => {
46-
if trim_comment(comment.as_str()).len() == 0 {
47-
span_lint_and_help(
48-
cx,
49-
EMPTY_DOCS,
50-
attribute.span,
51-
"empty doc comment",
52-
None,
53-
"consider removing or fill it",
54-
);
55-
}
56-
},
57-
_ => {},
44+
if let AttrKind::DocComment(_line, comment) = attribute.kind {
45+
if trim_comment(comment.as_str()).len() == 0 {
46+
span_lint_and_help(
47+
cx,
48+
EMPTY_DOCS,
49+
attribute.span,
50+
"empty doc comment",
51+
None,
52+
"consider removing or fill it",
53+
);
54+
}
5855
}
5956
}
6057
}

0 commit comments

Comments
 (0)