[PATCH 3/3] checkpatch.pl: --fix support for `//` comments rust private items

From: Arnaud Lecomte
Date: Tue Jul 29 2025 - 16:04:28 EST


Extend the Rust private item documentation checker (added in the previous
patch) to support automatic fixes when the `--fix` option is enabled.

Signed-off-by: Arnaud Lecomte <contact@xxxxxxxxxxxxxx>
---
scripts/checkpatch.pl | 3 +++
1 file changed, 3 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index ac403d270eb4..d01d993d8a9f 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3069,6 +3069,9 @@ sub process {
for (my $i = $start_l; $i <= $end_l; $i++) {
next unless $rawlines[$i - 1] =~ m@^\+//([^/].*)$@;
push @comment_lines, $rawlines[$i - 1];
+ if($fix) {
+ $fixed[$i - 1] =~ s/^\+(\/\/)/+$1\//;
+ }
}
my $formatted_comments = join("", map {
s/\n$//;
--
2.43.0