[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260207155627.122810-1-jason.kei.hall@gmail.com>
Date: Sat, 7 Feb 2026 08:56:27 -0700
From: Jason Hall <jason.kei.hall@...il.com>
To: Miguel Ojeda <miguel.ojeda.sandonis@...il.com>
Cc: Joe Perches <joe@...ches.com>,
Dirk Behme <dirk.behme@...bosch.com>,
Gary Guo <gary@...yguo.net>,
rust-for-linux@...r.kernel.org,
linux-kernel@...r.kernel.org,
Jason Hall <jason.kei.hall@...il.com>,
Miguel Ojeda <ojeda@...nel.org>
Subject: [PATCH v6] scripts: checkpatch: move Rust-specific lints to separate file
Create scripts/rust_checkpatch.pl for Rust-specific linting logic.
Add a conditional loading hook in scripts/checkpatch.pl to call it.
This will allow Rust linting logic to be maintained independently.
Add a new entry to the MAINTAINERS file to track this new file.
Suggested-by: Joe Perches <joe@...ches.com>
Suggested-by: Miguel Ojeda <ojeda@...nel.org>
Link: https://github.com/Rust-for-linux/linux/issues/1191
Signed-off-by: Jason Hall <jason.kei.hall@...il.com>
---
---
MAINTAINERS | 6 ++++++
scripts/rust_checkpatch.pl | 15 +++------------
2 files changed, 9 insertions(+), 12 deletions(-)
diff --git a/MAINTAINERS b/MAINTAINERS
index 2c0bdd08b74c..57831dc30e6b 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -5880,6 +5880,12 @@ R: Lukas Bulwahn <lukas.bulwahn@...il.com>
S: Maintained
F: scripts/checkpatch.pl
+CHECKPATCH RUST LINTS
+M: Jason Hall <jason.kei.hall@...il.com>
+L: rust-for-linux@...r.kernel.org
+S: Maintained
+F: scripts/rust_checkpatch.pl
+
CHECKPATCH DOCUMENTATION
M: Dwaipayan Ray <dwaipayanray1@...il.com>
M: Lukas Bulwahn <lukas.bulwahn@...il.com>
diff --git a/scripts/rust_checkpatch.pl b/scripts/rust_checkpatch.pl
index 69db5ded7371..56c1bc29d3f2 100644
--- a/scripts/rust_checkpatch.pl
+++ b/scripts/rust_checkpatch.pl
@@ -1,7 +1,7 @@
#!/usr/bin/env perl
# SPDX-License-Identifier: GPL-2.0
#
-# (c) 2026, Jason K. Hall <jason.kei.hall@...il.com>
+# (c) 2026, Jason Hall <jason.kei.hall@...il.com>
use strict;
use warnings;
@@ -9,17 +9,8 @@ use warnings;
sub process_rust {
my ($line, $rawline, $herecurr) = @_;
- # check for Rust unwrap/expect
- if ($line =~ /^\+/) {
- if ($line =~ /(?:\.|::)(?:unwrap|expect)\s*\(/ &&
- $rawline !~ /\/\/\s*PANIC:/ &&
- $line !~ /^\+\s*\/\// &&
- $line !~ /^\+\s*assert/) {
- return ("RUST_UNWRAP",
- "Avoid unwrap() or expect() in Rust code; use proper error handling (Result) or justify with a '// PANIC: ...' comment.\n" . $herecurr);
- }
- }
+ # Reserve for future Rust-specific lints
return ();
}
-1;
\ No newline at end of file
+1;
--
2.43.0
Powered by blists - more mailing lists