From 52f5d5fc9a3f65d205559fb5ad9b2504f5615626 Mon Sep 17 00:00:00 2001 From: Rob Bradford Date: Mon, 6 Jul 2026 23:28:07 +0100 Subject: [PATCH] pci: Fix clippy: use mem::take instead of drain().collect() ``` warning: you seem to be trying to move all elements into a new `Vec` --> pci/src/configuration.rs:951:24 | 951 | return self.pending_bar_reprogram.drain(..).collect(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `mem::take` to avoid creating a new allocation: `std::mem::take(&mut self.pending_bar_reprogram)` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#drain_collect = note: `-D clippy::drain-collect` implied by `-D clippy::all` ``` Signed-off-by: Rob Bradford --- pci/src/configuration.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pci/src/configuration.rs b/pci/src/configuration.rs index 9bd4bbbed..7f5e2de60 100644 --- a/pci/src/configuration.rs +++ b/pci/src/configuration.rs @@ -4,8 +4,8 @@ // // SPDX-License-Identifier: Apache-2.0 AND BSD-3-Clause -use std::result; use std::sync::{Arc, Mutex}; +use std::{mem, result}; use byteorder::{ByteOrder, LittleEndian}; use log::{info, warn}; @@ -948,7 +948,7 @@ impl PciConfiguration { "BAR reprogramming parameter is returned: {:x?}", self.pending_bar_reprogram ); - return self.pending_bar_reprogram.drain(..).collect(); + return mem::take(&mut self.pending_bar_reprogram); } info!( "MSE bit is disabled. No BAR reprogramming parameter is returned: {:x?}",