[PATCH v2] rust: kunit: fix warning when !CONFIG_PRINTK

Alexandre Courbot posted 1 patch 1 month, 3 weeks ago
rust/kernel/kunit.rs | 8 ++++++++
1 file changed, 8 insertions(+)
[PATCH v2] rust: kunit: fix warning when !CONFIG_PRINTK
Posted by Alexandre Courbot 1 month, 3 weeks ago
If `CONFIG_PRINTK` is not set, then the following warnings are issued
during build:

  warning: unused variable: `args`
    --> ../rust/kernel/kunit.rs:16:12
    |
  16 | pub fn err(args: fmt::Arguments<'_>) {
    |            ^^^^ help: if this is intentional, prefix it with an underscore: `_args`
    |
    = note: `#[warn(unused_variables)]` (part of `#[warn(unused)]`) on by default

  warning: unused variable: `args`
    --> ../rust/kernel/kunit.rs:32:13
    |
  32 | pub fn info(args: fmt::Arguments<'_>) {
    |             ^^^^ help: if this is intentional, prefix it with an underscore: `_args`

Fix this by adding a no-op assignment using `args` when `CONFIG_PRINTK`
is not set.

Fixes: a66d733da801 ("rust: support running Rust documentation tests as KUnit ones")
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
---
Changes in v2:
- Use a no-op assignment instead of the wider `#[allow(unused_variables)]`.
- Link to v1: https://patch.msgid.link/20260224-unused_var_err-v1-1-c51d805eceb5@nvidia.com
---
 rust/kernel/kunit.rs | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/rust/kernel/kunit.rs b/rust/kernel/kunit.rs
index f93f24a60bdd..a1edf7491579 100644
--- a/rust/kernel/kunit.rs
+++ b/rust/kernel/kunit.rs
@@ -14,6 +14,10 @@
 /// Public but hidden since it should only be used from KUnit generated code.
 #[doc(hidden)]
 pub fn err(args: fmt::Arguments<'_>) {
+    // `args` is unused if `CONFIG_PRINTK` is not set - this avoids a build-time warning.
+    #[cfg(not(CONFIG_PRINTK))]
+    let _ = args;
+
     // SAFETY: The format string is null-terminated and the `%pA` specifier matches the argument we
     // are passing.
     #[cfg(CONFIG_PRINTK)]
@@ -30,6 +34,10 @@ pub fn err(args: fmt::Arguments<'_>) {
 /// Public but hidden since it should only be used from KUnit generated code.
 #[doc(hidden)]
 pub fn info(args: fmt::Arguments<'_>) {
+    // `args` is unused if `CONFIG_PRINTK` is not set - this avoids a build-time warning.
+    #[cfg(not(CONFIG_PRINTK))]
+    let _ = args;
+
     // SAFETY: The format string is null-terminated and the `%pA` specifier matches the argument we
     // are passing.
     #[cfg(CONFIG_PRINTK)]

---
base-commit: 6de23f81a5e08be8fbf5e8d7e9febc72a5b5f27f
change-id: 20260224-unused_var_err-996d7ffa27c5

Best regards,
-- 
Alexandre Courbot <acourbot@nvidia.com>
Re: [PATCH v2] rust: kunit: fix warning when !CONFIG_PRINTK
Posted by Miguel Ojeda 1 month, 1 week ago
On Tue, Feb 24, 2026 at 11:38 AM Alexandre Courbot <acourbot@nvidia.com> wrote:
>
> If `CONFIG_PRINTK` is not set, then the following warnings are issued
> during build:
>
>   warning: unused variable: `args`
>     --> ../rust/kernel/kunit.rs:16:12
>     |
>   16 | pub fn err(args: fmt::Arguments<'_>) {
>     |            ^^^^ help: if this is intentional, prefix it with an underscore: `_args`
>     |
>     = note: `#[warn(unused_variables)]` (part of `#[warn(unused)]`) on by default
>
>   warning: unused variable: `args`
>     --> ../rust/kernel/kunit.rs:32:13
>     |
>   32 | pub fn info(args: fmt::Arguments<'_>) {
>     |             ^^^^ help: if this is intentional, prefix it with an underscore: `_args`
>
> Fix this by adding a no-op assignment using `args` when `CONFIG_PRINTK`
> is not set.
>
> Fixes: a66d733da801 ("rust: support running Rust documentation tests as KUnit ones")
> Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>

Applied to `rust-fixes` -- thanks everyone!

Also Cc: stable@vger.kernel.org

Cheers,
Miguel
Re: [PATCH v2] rust: kunit: fix warning when !CONFIG_PRINTK
Posted by David Gow 1 month, 1 week ago
Le 04/03/2026 à 10:34 AM, Miguel Ojeda a écrit :
> On Tue, Feb 24, 2026 at 11:38 AM Alexandre Courbot <acourbot@nvidia.com> wrote:
>>
>> If `CONFIG_PRINTK` is not set, then the following warnings are issued
>> during build:
>>
>>    warning: unused variable: `args`
>>      --> ../rust/kernel/kunit.rs:16:12
>>      |
>>    16 | pub fn err(args: fmt::Arguments<'_>) {
>>      |            ^^^^ help: if this is intentional, prefix it with an underscore: `_args`
>>      |
>>      = note: `#[warn(unused_variables)]` (part of `#[warn(unused)]`) on by default
>>
>>    warning: unused variable: `args`
>>      --> ../rust/kernel/kunit.rs:32:13
>>      |
>>    32 | pub fn info(args: fmt::Arguments<'_>) {
>>      |             ^^^^ help: if this is intentional, prefix it with an underscore: `_args`
>>
>> Fix this by adding a no-op assignment using `args` when `CONFIG_PRINTK`
>> is not set.
>>
>> Fixes: a66d733da801 ("rust: support running Rust documentation tests as KUnit ones")
>> Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
> 
> Applied to `rust-fixes` -- thanks everyone!
> 
> Also Cc: stable@vger.kernel.org

This is also sitting in kselftest/kunit-fixes:
https://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest.git/commit/?h=kunit-fixes&id=7dd34dfc8dfa92a7244242098110388367996ac3

I don't particularly mind if you'd rather it go through the Rust tree, 
though. Let me know if you want this removed.

Cheers,
-- David

Re: [PATCH v2] rust: kunit: fix warning when !CONFIG_PRINTK
Posted by Miguel Ojeda 1 month, 1 week ago
On Wed, Mar 4, 2026 at 10:16 AM David Gow <david@davidgow.net> wrote:
>
> This is also sitting in kselftest/kunit-fixes:
> https://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest.git/commit/?h=kunit-fixes&id=7dd34dfc8dfa92a7244242098110388367996ac3
>
> I don't particularly mind if you'd rather it go through the Rust tree,
> though. Let me know if you want this removed.

Ah, good, thanks!

I saw your Reviewed-by and no notification of being queued so I
thought you expected me to pick it up.

Happy to remove it, but it would be nice to get the Cc: stable@ there
to avoid having to send it later.

Cheers,
Miguel
Re: [PATCH v2] rust: kunit: fix warning when !CONFIG_PRINTK
Posted by Miguel Ojeda 1 month, 1 week ago
On Wed, Mar 4, 2026 at 1:07 PM Miguel Ojeda
<miguel.ojeda.sandonis@gmail.com> wrote:
>
> Ah, good, thanks!
>
> I saw your Reviewed-by and no notification of being queued so I
> thought you expected me to pick it up.
>
> Happy to remove it, but it would be nice to get the Cc: stable@ there
> to avoid having to send it later.

Ok, I will remove it since I am not hearing anything, but I will send
a message to stable now to avoid forgetting about it later.

Cc'ing Shuah, by the way.

Thanks!

Cheers,
Miguel
Re: [PATCH v2] rust: kunit: fix warning when !CONFIG_PRINTK
Posted by David Gow 1 month, 3 weeks ago
Le 24/02/2026 à 6:37 PM, 'Alexandre Courbot' via KUnit Development a écrit :
> If `CONFIG_PRINTK` is not set, then the following warnings are issued
> during build:
> 
>    warning: unused variable: `args`
>      --> ../rust/kernel/kunit.rs:16:12
>      |
>    16 | pub fn err(args: fmt::Arguments<'_>) {
>      |            ^^^^ help: if this is intentional, prefix it with an underscore: `_args`
>      |
>      = note: `#[warn(unused_variables)]` (part of `#[warn(unused)]`) on by default
> 
>    warning: unused variable: `args`
>      --> ../rust/kernel/kunit.rs:32:13
>      |
>    32 | pub fn info(args: fmt::Arguments<'_>) {
>      |             ^^^^ help: if this is intentional, prefix it with an underscore: `_args`
> 
> Fix this by adding a no-op assignment using `args` when `CONFIG_PRINTK`
> is not set.
> 
> Fixes: a66d733da801 ("rust: support running Rust documentation tests as KUnit ones")
> Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
> ---
> Changes in v2:
> - Use a no-op assignment instead of the wider `#[allow(unused_variables)]`.
> - Link to v1: https://patch.msgid.link/20260224-unused_var_err-v1-1-c51d805eceb5@nvidia.com
> ---

Reviewed-by: David Gow <david@davidgow.net>

Cheers,
-- David
Re: [PATCH v2] rust: kunit: fix warning when !CONFIG_PRINTK
Posted by Andreas Hindborg 1 month, 3 weeks ago
"Alexandre Courbot" <acourbot@nvidia.com> writes:

> If `CONFIG_PRINTK` is not set, then the following warnings are issued
> during build:
>
>   warning: unused variable: `args`
>     --> ../rust/kernel/kunit.rs:16:12
>     |
>   16 | pub fn err(args: fmt::Arguments<'_>) {
>     |            ^^^^ help: if this is intentional, prefix it with an underscore: `_args`
>     |
>     = note: `#[warn(unused_variables)]` (part of `#[warn(unused)]`) on by default
>
>   warning: unused variable: `args`
>     --> ../rust/kernel/kunit.rs:32:13
>     |
>   32 | pub fn info(args: fmt::Arguments<'_>) {
>     |             ^^^^ help: if this is intentional, prefix it with an underscore: `_args`
>
> Fix this by adding a no-op assignment using `args` when `CONFIG_PRINTK`
> is not set.
>
> Fixes: a66d733da801 ("rust: support running Rust documentation tests as KUnit ones")
> Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
> ---
> Changes in v2:
> - Use a no-op assignment instead of the wider `#[allow(unused_variables)]`.
> - Link to v1: https://patch.msgid.link/20260224-unused_var_err-v1-1-c51d805eceb5@nvidia.com
> ---
>  rust/kernel/kunit.rs | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/rust/kernel/kunit.rs b/rust/kernel/kunit.rs
> index f93f24a60bdd..a1edf7491579 100644
> --- a/rust/kernel/kunit.rs
> +++ b/rust/kernel/kunit.rs
> @@ -14,6 +14,10 @@
>  /// Public but hidden since it should only be used from KUnit generated code.
>  #[doc(hidden)]
>  pub fn err(args: fmt::Arguments<'_>) {
> +    // `args` is unused if `CONFIG_PRINTK` is not set - this avoids a build-time warning.
> +    #[cfg(not(CONFIG_PRINTK))]
> +    let _ = args;

I think (didn't test) that you can use a conditional attribute [1] instead:

 pub fn err(
     #[cfg_attr(not(CONFIG_PRINTK), expect(unused))]
     args: fmt::Arguments<'_>
 ) {

Best regards,
Andreas Hindborg


[1] https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg_attr-attribute
Re: [PATCH v2] rust: kunit: fix warning when !CONFIG_PRINTK
Posted by Alexandre Courbot 1 month, 3 weeks ago
On Tue Feb 24, 2026 at 8:51 PM JST, Andreas Hindborg wrote:
> "Alexandre Courbot" <acourbot@nvidia.com> writes:
>
>> If `CONFIG_PRINTK` is not set, then the following warnings are issued
>> during build:
>>
>>   warning: unused variable: `args`
>>     --> ../rust/kernel/kunit.rs:16:12
>>     |
>>   16 | pub fn err(args: fmt::Arguments<'_>) {
>>     |            ^^^^ help: if this is intentional, prefix it with an underscore: `_args`
>>     |
>>     = note: `#[warn(unused_variables)]` (part of `#[warn(unused)]`) on by default
>>
>>   warning: unused variable: `args`
>>     --> ../rust/kernel/kunit.rs:32:13
>>     |
>>   32 | pub fn info(args: fmt::Arguments<'_>) {
>>     |             ^^^^ help: if this is intentional, prefix it with an underscore: `_args`
>>
>> Fix this by adding a no-op assignment using `args` when `CONFIG_PRINTK`
>> is not set.
>>
>> Fixes: a66d733da801 ("rust: support running Rust documentation tests as KUnit ones")
>> Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
>> ---
>> Changes in v2:
>> - Use a no-op assignment instead of the wider `#[allow(unused_variables)]`.
>> - Link to v1: https://patch.msgid.link/20260224-unused_var_err-v1-1-c51d805eceb5@nvidia.com
>> ---
>>  rust/kernel/kunit.rs | 8 ++++++++
>>  1 file changed, 8 insertions(+)
>>
>> diff --git a/rust/kernel/kunit.rs b/rust/kernel/kunit.rs
>> index f93f24a60bdd..a1edf7491579 100644
>> --- a/rust/kernel/kunit.rs
>> +++ b/rust/kernel/kunit.rs
>> @@ -14,6 +14,10 @@
>>  /// Public but hidden since it should only be used from KUnit generated code.
>>  #[doc(hidden)]
>>  pub fn err(args: fmt::Arguments<'_>) {
>> +    // `args` is unused if `CONFIG_PRINTK` is not set - this avoids a build-time warning.
>> +    #[cfg(not(CONFIG_PRINTK))]
>> +    let _ = args;
>
> I think (didn't test) that you can use a conditional attribute [1] instead:
>
>  pub fn err(
>      #[cfg_attr(not(CONFIG_PRINTK), expect(unused))]
>      args: fmt::Arguments<'_>
>  ) {

Yup, that works as well, and I think I like it better as it is more
localized. Alice, WDYT?
Re: [PATCH v2] rust: kunit: fix warning when !CONFIG_PRINTK
Posted by David Gow 1 month, 3 weeks ago
Le 24/02/2026 à 9:07 PM, 'Alexandre Courbot' via KUnit Development a écrit :
> On Tue Feb 24, 2026 at 8:51 PM JST, Andreas Hindborg wrote:
>> "Alexandre Courbot" <acourbot@nvidia.com> writes:
>>
>>> If `CONFIG_PRINTK` is not set, then the following warnings are issued
>>> during build:
>>>
>>>    warning: unused variable: `args`
>>>      --> ../rust/kernel/kunit.rs:16:12
>>>      |
>>>    16 | pub fn err(args: fmt::Arguments<'_>) {
>>>      |            ^^^^ help: if this is intentional, prefix it with an underscore: `_args`
>>>      |
>>>      = note: `#[warn(unused_variables)]` (part of `#[warn(unused)]`) on by default
>>>
>>>    warning: unused variable: `args`
>>>      --> ../rust/kernel/kunit.rs:32:13
>>>      |
>>>    32 | pub fn info(args: fmt::Arguments<'_>) {
>>>      |             ^^^^ help: if this is intentional, prefix it with an underscore: `_args`
>>>
>>> Fix this by adding a no-op assignment using `args` when `CONFIG_PRINTK`
>>> is not set.
>>>
>>> Fixes: a66d733da801 ("rust: support running Rust documentation tests as KUnit ones")
>>> Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
>>> ---
>>> Changes in v2:
>>> - Use a no-op assignment instead of the wider `#[allow(unused_variables)]`.
>>> - Link to v1: https://patch.msgid.link/20260224-unused_var_err-v1-1-c51d805eceb5@nvidia.com
>>> ---
>>>   rust/kernel/kunit.rs | 8 ++++++++
>>>   1 file changed, 8 insertions(+)
>>>
>>> diff --git a/rust/kernel/kunit.rs b/rust/kernel/kunit.rs
>>> index f93f24a60bdd..a1edf7491579 100644
>>> --- a/rust/kernel/kunit.rs
>>> +++ b/rust/kernel/kunit.rs
>>> @@ -14,6 +14,10 @@
>>>   /// Public but hidden since it should only be used from KUnit generated code.
>>>   #[doc(hidden)]
>>>   pub fn err(args: fmt::Arguments<'_>) {
>>> +    // `args` is unused if `CONFIG_PRINTK` is not set - this avoids a build-time warning.
>>> +    #[cfg(not(CONFIG_PRINTK))]
>>> +    let _ = args;
>>
>> I think (didn't test) that you can use a conditional attribute [1] instead:
>>
>>   pub fn err(
>>       #[cfg_attr(not(CONFIG_PRINTK), expect(unused))]
>>       args: fmt::Arguments<'_>
>>   ) {
> 
> Yup, that works as well, and I think I like it better as it is more
> localized. Alice, WDYT?
> 

Personally, I have a slight preference for the current `let _ = args` 
option -- we'll still want to be able to format (at least some of) these 
messages to the KUnit test log, even if printk is disabled. So in the 
interest of avoiding churn in the function prototype, this version seems 
more future-proof.

But I'm not enormously worried either way.

Cheers,
-- David

Re: [PATCH v2] rust: kunit: fix warning when !CONFIG_PRINTK
Posted by Alexandre Courbot 1 month, 3 weeks ago
On Tue Feb 24, 2026 at 10:56 PM JST, David Gow wrote:
> Le 24/02/2026 à 9:07 PM, 'Alexandre Courbot' via KUnit Development a écrit :
>> On Tue Feb 24, 2026 at 8:51 PM JST, Andreas Hindborg wrote:
>>> "Alexandre Courbot" <acourbot@nvidia.com> writes:
>>>
>>>> If `CONFIG_PRINTK` is not set, then the following warnings are issued
>>>> during build:
>>>>
>>>>    warning: unused variable: `args`
>>>>      --> ../rust/kernel/kunit.rs:16:12
>>>>      |
>>>>    16 | pub fn err(args: fmt::Arguments<'_>) {
>>>>      |            ^^^^ help: if this is intentional, prefix it with an underscore: `_args`
>>>>      |
>>>>      = note: `#[warn(unused_variables)]` (part of `#[warn(unused)]`) on by default
>>>>
>>>>    warning: unused variable: `args`
>>>>      --> ../rust/kernel/kunit.rs:32:13
>>>>      |
>>>>    32 | pub fn info(args: fmt::Arguments<'_>) {
>>>>      |             ^^^^ help: if this is intentional, prefix it with an underscore: `_args`
>>>>
>>>> Fix this by adding a no-op assignment using `args` when `CONFIG_PRINTK`
>>>> is not set.
>>>>
>>>> Fixes: a66d733da801 ("rust: support running Rust documentation tests as KUnit ones")
>>>> Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
>>>> ---
>>>> Changes in v2:
>>>> - Use a no-op assignment instead of the wider `#[allow(unused_variables)]`.
>>>> - Link to v1: https://patch.msgid.link/20260224-unused_var_err-v1-1-c51d805eceb5@nvidia.com
>>>> ---
>>>>   rust/kernel/kunit.rs | 8 ++++++++
>>>>   1 file changed, 8 insertions(+)
>>>>
>>>> diff --git a/rust/kernel/kunit.rs b/rust/kernel/kunit.rs
>>>> index f93f24a60bdd..a1edf7491579 100644
>>>> --- a/rust/kernel/kunit.rs
>>>> +++ b/rust/kernel/kunit.rs
>>>> @@ -14,6 +14,10 @@
>>>>   /// Public but hidden since it should only be used from KUnit generated code.
>>>>   #[doc(hidden)]
>>>>   pub fn err(args: fmt::Arguments<'_>) {
>>>> +    // `args` is unused if `CONFIG_PRINTK` is not set - this avoids a build-time warning.
>>>> +    #[cfg(not(CONFIG_PRINTK))]
>>>> +    let _ = args;
>>>
>>> I think (didn't test) that you can use a conditional attribute [1] instead:
>>>
>>>   pub fn err(
>>>       #[cfg_attr(not(CONFIG_PRINTK), expect(unused))]
>>>       args: fmt::Arguments<'_>
>>>   ) {
>> 
>> Yup, that works as well, and I think I like it better as it is more
>> localized. Alice, WDYT?
>> 
>
> Personally, I have a slight preference for the current `let _ = args` 
> option -- we'll still want to be able to format (at least some of) these 
> messages to the KUnit test log, even if printk is disabled. So in the 
> interest of avoiding churn in the function prototype, this version seems 
> more future-proof.

Sounds good - let's keep the current version then.
Re: [PATCH v2] rust: kunit: fix warning when !CONFIG_PRINTK
Posted by Alice Ryhl 1 month, 3 weeks ago
On Tue, Feb 24, 2026 at 2:07 PM Alexandre Courbot <acourbot@nvidia.com> wrote:
>
> On Tue Feb 24, 2026 at 8:51 PM JST, Andreas Hindborg wrote:
> > "Alexandre Courbot" <acourbot@nvidia.com> writes:
> >
> >> If `CONFIG_PRINTK` is not set, then the following warnings are issued
> >> during build:
> >>
> >>   warning: unused variable: `args`
> >>     --> ../rust/kernel/kunit.rs:16:12
> >>     |
> >>   16 | pub fn err(args: fmt::Arguments<'_>) {
> >>     |            ^^^^ help: if this is intentional, prefix it with an underscore: `_args`
> >>     |
> >>     = note: `#[warn(unused_variables)]` (part of `#[warn(unused)]`) on by default
> >>
> >>   warning: unused variable: `args`
> >>     --> ../rust/kernel/kunit.rs:32:13
> >>     |
> >>   32 | pub fn info(args: fmt::Arguments<'_>) {
> >>     |             ^^^^ help: if this is intentional, prefix it with an underscore: `_args`
> >>
> >> Fix this by adding a no-op assignment using `args` when `CONFIG_PRINTK`
> >> is not set.
> >>
> >> Fixes: a66d733da801 ("rust: support running Rust documentation tests as KUnit ones")
> >> Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
> >> ---
> >> Changes in v2:
> >> - Use a no-op assignment instead of the wider `#[allow(unused_variables)]`.
> >> - Link to v1: https://patch.msgid.link/20260224-unused_var_err-v1-1-c51d805eceb5@nvidia.com
> >> ---
> >>  rust/kernel/kunit.rs | 8 ++++++++
> >>  1 file changed, 8 insertions(+)
> >>
> >> diff --git a/rust/kernel/kunit.rs b/rust/kernel/kunit.rs
> >> index f93f24a60bdd..a1edf7491579 100644
> >> --- a/rust/kernel/kunit.rs
> >> +++ b/rust/kernel/kunit.rs
> >> @@ -14,6 +14,10 @@
> >>  /// Public but hidden since it should only be used from KUnit generated code.
> >>  #[doc(hidden)]
> >>  pub fn err(args: fmt::Arguments<'_>) {
> >> +    // `args` is unused if `CONFIG_PRINTK` is not set - this avoids a build-time warning.
> >> +    #[cfg(not(CONFIG_PRINTK))]
> >> +    let _ = args;
> >
> > I think (didn't test) that you can use a conditional attribute [1] instead:
> >
> >  pub fn err(
> >      #[cfg_attr(not(CONFIG_PRINTK), expect(unused))]
> >      args: fmt::Arguments<'_>
> >  ) {
>
> Yup, that works as well, and I think I like it better as it is more
> localized. Alice, WDYT?

 I think the other options is also quite localised. It's per function
argument too. shrug

Alice
Re: [PATCH v2] rust: kunit: fix warning when !CONFIG_PRINTK
Posted by Alice Ryhl 1 month, 3 weeks ago
On Tue, Feb 24, 2026 at 07:37:56PM +0900, Alexandre Courbot wrote:
> If `CONFIG_PRINTK` is not set, then the following warnings are issued
> during build:
> 
>   warning: unused variable: `args`
>     --> ../rust/kernel/kunit.rs:16:12
>     |
>   16 | pub fn err(args: fmt::Arguments<'_>) {
>     |            ^^^^ help: if this is intentional, prefix it with an underscore: `_args`
>     |
>     = note: `#[warn(unused_variables)]` (part of `#[warn(unused)]`) on by default
> 
>   warning: unused variable: `args`
>     --> ../rust/kernel/kunit.rs:32:13
>     |
>   32 | pub fn info(args: fmt::Arguments<'_>) {
>     |             ^^^^ help: if this is intentional, prefix it with an underscore: `_args`
> 
> Fix this by adding a no-op assignment using `args` when `CONFIG_PRINTK`
> is not set.
> 
> Fixes: a66d733da801 ("rust: support running Rust documentation tests as KUnit ones")
> Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>

Reviewed-by: Alice Ryhl <aliceryhl@google.com>