* [PATCH] rust: kunit: avoid retain_mut for test attr filtering
@ 2026-02-25 20:27 Elsanti
2026-02-25 21:04 ` Gary Guo
0 siblings, 1 reply; 2+ messages in thread
From: Elsanti @ 2026-02-25 20:27 UTC (permalink / raw)
To: brendan.higgins, davidgow, ojeda
Cc: raemoar63, boqun, gary, bjorn3_gh, lossin, a.hindborg, aliceryhl,
tmgross, dakr, linux-kselftest, kunit-dev, rust-for-linux,
linux-kernel, Elsanti
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>
---
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;
--
2.53.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] rust: kunit: avoid retain_mut for test attr filtering
2026-02-25 20:27 [PATCH] rust: kunit: avoid retain_mut for test attr filtering Elsanti
@ 2026-02-25 21:04 ` Gary Guo
0 siblings, 0 replies; 2+ messages in thread
From: Gary Guo @ 2026-02-25 21:04 UTC (permalink / raw)
To: Elsanti
Cc: brendan.higgins, davidgow, ojeda, raemoar63, boqun, bjorn3_gh,
lossin, a.hindborg, aliceryhl, tmgross, dakr, linux-kselftest,
kunit-dev, rust-for-linux, linux-kernel
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;
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-02-25 21:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-02-25 20:27 [PATCH] rust: kunit: avoid retain_mut for test attr filtering Elsanti
2026-02-25 21:04 ` Gary Guo
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®