On Thu, Jul 20, 2023 at 8:30 AM David Gow davidgow@google.com wrote:
While Rust uses 4 spaces for indentation, we should use tabs in the generated C code. This does result in some scary-looking tab characters in a .rs file, but they're in a string literal, so shouldn't make anything complain too much.
Fixes: a66d733da801 ("rust: support running Rust documentation tests as KUnit ones") Signed-off-by: David Gow davidgow@google.com
The indentation for the `KUNIT_CASE()` lines should be changed too:
diff --git a/scripts/rustdoc_test_gen.rs b/scripts/rustdoc_test_gen.rs index 5ebd42ae4a3f..9623e2e6313d 100644 --- a/scripts/rustdoc_test_gen.rs +++ b/scripts/rustdoc_test_gen.rs @@ -213,7 +213,7 @@ macro_rules! assert_eq {{ .unwrap();
write!(c_test_declarations, "void {kunit_name}(struct kunit *);\n").unwrap(); - write!(c_test_cases, " KUNIT_CASE({kunit_name}),\n").unwrap(); + write!(c_test_cases, " KUNIT_CASE({kunit_name}),\n").unwrap(); }
let rust_tests = rust_tests.trim();
With that:
Acked-by: Miguel Ojeda ojeda@kernel.org
Since the changes are within string literals, I don't expect issues, but I just in case I ran it through `checkpatch.pl`, `rustfmt` and `CLIPPY=1`:
Tested-by: Miguel Ojeda ojeda@kernel.org
Thanks!
Cheers, Miguel