Skip to content

Commit b64a13c

Browse files
hrideshmgintel-lab-lkp
authored andcommitted
checkpatch: warn on empty rust doc comments
Add a check to warn if there are consecutive empty `///` lines in rust files. Suggested-by: Miguel Ojeda <[email protected]> Link: Rust-for-Linux#1109 Signed-off-by: Hridesh MG <[email protected]>
1 parent d3e01b6 commit b64a13c

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

scripts/checkpatch.pl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3884,6 +3884,13 @@ sub process {
38843884
}
38853885
}
38863886

3887+
# check for consecutive empty /// lines in .rs files
3888+
if ($realfile =~ /\.rs$/ &&
3889+
$rawline =~ /^\+\s*\/\/\/$/ && $prevrawline =~ /^\+\s*\/\/\/$/) {
3890+
WARN("RUST_DOC_EMPTY",
3891+
"avoid using consecutive empty rustdoc comments\n" . $herecurr);
3892+
}
3893+
38873894
# check for adding lines without a newline.
38883895
if ($line =~ /^\+/ && defined $lines[$linenr] && $lines[$linenr] =~ /^\\ No newline at end of file/) {
38893896
if (WARN("MISSING_EOF_NEWLINE",

0 commit comments

Comments
 (0)