scripts: rust: replace length checks with match
authorTamir Duberstein <tamird@gmail.com>
Thu, 29 May 2025 13:14:58 +0000 (09:14 -0400)
committerMiguel Ojeda <ojeda@kernel.org>
Sun, 20 Jul 2025 22:03:01 +0000 (00:03 +0200)
commit8b097b5ac68b0fd2a7a251e101a84175b2ed585d
tree6251d676fdbbd132f8b0030a1f0f72d4a576496a
parent275ad5e7931160aca2ea7657f7be7ef3493dea79
scripts: rust: replace length checks with match

Use a match expression with slice patterns instead of length checks and
indexing. The result is more idiomatic, which is a better example for
future Rust code authors.

Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Signed-off-by: Tamir Duberstein <tamird@gmail.com>
Link: https://lore.kernel.org/r/20250529-idiomatic-match-slice-v2-1-4925ca2f1550@gmail.com
[ Reworded title. - Miguel ]
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
scripts/rustdoc_test_gen.rs