[PATCH] rust: kunit: avoid retain_mut for test attr filtering
From: Elsanti
Date: Wed Feb 25 2026 - 15:27:48 EST
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@xxxxxxxxx>
---
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