rust/macros/kunit.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
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
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;
© 2016 - 2026 Red Hat, Inc.