From: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
To: David Gow <davidgow@google.com>
Cc: Brendan Higgins <brendan.higgins@linux.dev>,
Miguel Ojeda <ojeda@kernel.org>,
Shuah Khan <skhan@linuxfoundation.org>,
linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com,
rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] rust: doctests: Use tabs for indentation in generated C code
Date: Thu, 20 Jul 2023 11:55:35 +0200 [thread overview]
Message-ID: <CANiq72k5mJDP8L2Mx8xWxts++kwiJXPTk88MTJQOvCiEKRMvYw@mail.gmail.com> (raw)
In-Reply-To: <20230720062939.2411889-1-davidgow@google.com>
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
next prev parent reply other threads:[~2023-07-20 9:55 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-20 6:29 [PATCH] rust: doctests: Use tabs for indentation in generated C code David Gow
2023-07-20 9:55 ` Miguel Ojeda [this message]
2023-07-21 0:27 ` Martin Rodriguez Reboredo
2023-07-21 16:10 ` Miguel Ojeda
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CANiq72k5mJDP8L2Mx8xWxts++kwiJXPTk88MTJQOvCiEKRMvYw@mail.gmail.com \
--to=miguel.ojeda.sandonis@gmail.com \
--cc=brendan.higgins@linux.dev \
--cc=davidgow@google.com \
--cc=kunit-dev@googlegroups.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=skhan@linuxfoundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).