Re: [PATCH] rust_binder: clean Clippy `mem-replace-with-default` warning
From: Alice Ryhl
Date: Mon Oct 13 2025 - 05:19:34 EST
On Sun, Oct 12, 2025 at 11:32:30PM +0200, Miguel Ojeda wrote:
> Starting with Rust 1.87.0, Clippy reports:
>
> CLIPPY drivers/android/binder/rust_binder_main.o
> error: replacing a value of type `T` with `T::default()` is better expressed using `core::mem::take`
> --> drivers/android/binder/node.rs:690:32
> |
> 690 | _unused_capacity = mem::replace(&mut inner.freeze_list, KVVec::new());
> | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `core::mem::take(&mut inner.freeze_list)`
> |
> = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#mem_replace_with_default
> = note: `-D clippy::mem-replace-with-default` implied by `-D warnings`
> = help: to override `-D warnings` add `#[allow(clippy::mem_replace_with_default)]`
>
> Thus clean it up as suggested.
>
> Fixes: eafedbc7c050 ("rust_binder: add Rust Binder driver")
> Signed-off-by: Miguel Ojeda <ojeda@xxxxxxxxxx>
Thanks. I guess I never got around to making use of commit 47d8101924b5
("rust: vec: impl Default for Vec with any allocator").
Reviewed-by: Alice Ryhl <aliceryhl@xxxxxxxxxx>