mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Gary Guo <gary@garyguo.net>
To: Elsanti <santiagojoseleal27@gmail.com>
Cc: brendan.higgins@linux.dev, davidgow@google.com, ojeda@kernel.org,
	raemoar63@gmail.com, boqun@kernel.org, bjorn3_gh@protonmail.com,
	lossin@kernel.org, a.hindborg@kernel.org, aliceryhl@google.com,
	tmgross@umich.edu, dakr@kernel.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: kunit: avoid retain_mut for test attr filtering
Date: Wed, 25 Feb 2026 21:04:05 +0000	[thread overview]
Message-ID: <13a713a8260f566386c724c49ecf8a34@garyguo.net> (raw)
In-Reply-To: <20260225202728.2160793-1-santiagojoseleal27@gmail.com>

On 2026-02-25 20:27, Elsanti wrote:
> Remove the unnecessary mutable borrow when stripping #[test] attributes:
> retain() is sufficient to drop test markers while tracking their presence.
> This keeps the logic compatible with the current MSRV and avoids extra
> mutability.
> 
> Signed-off-by: Elsanti <santiagojoseleal27@gmail.com>

New versions should be sent if you want to amend your patch, not a new commit
on top of it.

Best,
Gary

> ---
>  rust/macros/kunit.rs | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/rust/macros/kunit.rs b/rust/macros/kunit.rs
> index e064419bfc10..083b8fe39e6c 100644
> --- a/rust/macros/kunit.rs
> +++ b/rust/macros/kunit.rs
> @@ -88,7 +88,7 @@ pub(crate) fn kunit_tests(test_suite: Ident, mut module: ItemMod) -> Result<Toke
>          };
>  
>          let mut had_test_attr = false;
> -        f.attrs.retain_mut(|attr| {
> +        f.attrs.retain(|attr| {
>              let is_test = attr.path().is_ident("test");
>              if is_test {
>                  had_test_attr = true;

      reply	other threads:[~2026-02-25 21:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-25 20:27 Elsanti
2026-02-25 21:04 ` Gary Guo [this message]

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=13a713a8260f566386c724c49ecf8a34@garyguo.net \
    --to=gary@garyguo.net \
    --cc=a.hindborg@kernel.org \
    --cc=aliceryhl@google.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun@kernel.org \
    --cc=brendan.higgins@linux.dev \
    --cc=dakr@kernel.org \
    --cc=davidgow@google.com \
    --cc=kunit-dev@googlegroups.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=lossin@kernel.org \
    --cc=ojeda@kernel.org \
    --cc=raemoar63@gmail.com \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=santiagojoseleal27@gmail.com \
    --cc=tmgross@umich.edu \
    /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

all inboxes | Powered by JetHome®