clippy: Fix redundant allocations

With the new beta version, clippy complains about redundant allocation
when using Arc<Box<dyn T>>, and suggests replacing it simply with
Arc<dyn T>.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
Sebastien Boeuf
2021-07-29 11:15:10 +02:00
parent 91bd4ee8cc
commit dcc646f5b1
18 changed files with 57 additions and 66 deletions

View File

@@ -159,11 +159,11 @@ impl MsiCap {
pub struct MsiConfig {
cap: MsiCap,
interrupt_source_group: Arc<Box<dyn InterruptSourceGroup>>,
interrupt_source_group: Arc<dyn InterruptSourceGroup>,
}
impl MsiConfig {
pub fn new(msg_ctl: u16, interrupt_source_group: Arc<Box<dyn InterruptSourceGroup>>) -> Self {
pub fn new(msg_ctl: u16, interrupt_source_group: Arc<dyn InterruptSourceGroup>) -> Self {
let cap = MsiCap {
msg_ctl,
..Default::default()

View File

@@ -74,7 +74,7 @@ pub struct MsixConfig {
pub table_entries: Vec<MsixTableEntry>,
pub pba_entries: Vec<u64>,
pub devid: u32,
interrupt_source_group: Arc<Box<dyn InterruptSourceGroup>>,
interrupt_source_group: Arc<dyn InterruptSourceGroup>,
masked: bool,
enabled: bool,
}
@@ -82,7 +82,7 @@ pub struct MsixConfig {
impl MsixConfig {
pub fn new(
msix_vectors: u16,
interrupt_source_group: Arc<Box<dyn InterruptSourceGroup>>,
interrupt_source_group: Arc<dyn InterruptSourceGroup>,
devid: u32,
) -> Self {
assert!(msix_vectors <= MAX_MSIX_VECTORS_PER_DEVICE);

View File

@@ -89,14 +89,14 @@ enum InterruptUpdateAction {
}
struct VfioIntx {
interrupt_source_group: Arc<Box<dyn InterruptSourceGroup>>,
interrupt_source_group: Arc<dyn InterruptSourceGroup>,
enabled: bool,
}
struct VfioMsi {
cfg: MsiConfig,
cap_offset: u32,
interrupt_source_group: Arc<Box<dyn InterruptSourceGroup>>,
interrupt_source_group: Arc<dyn InterruptSourceGroup>,
}
impl VfioMsi {
@@ -123,7 +123,7 @@ struct VfioMsix {
bar: MsixConfig,
cap: MsixCap,
cap_offset: u32,
interrupt_source_group: Arc<Box<dyn InterruptSourceGroup>>,
interrupt_source_group: Arc<dyn InterruptSourceGroup>,
}
impl VfioMsix {
@@ -309,7 +309,7 @@ impl VfioPciDevice {
device: VfioDevice,
container: Arc<VfioContainer>,
msi_interrupt_manager: &Arc<dyn InterruptManager<GroupConfig = MsiIrqGroupConfig>>,
legacy_interrupt_group: Option<Arc<Box<dyn InterruptSourceGroup>>>,
legacy_interrupt_group: Option<Arc<dyn InterruptSourceGroup>>,
iommu_attached: bool,
) -> Result<Self> {
let device = Arc::new(device);
@@ -438,7 +438,7 @@ impl VfioPciDevice {
fn initialize_legacy_interrupt(
&mut self,
legacy_interrupt_group: Option<Arc<Box<dyn InterruptSourceGroup>>>,
legacy_interrupt_group: Option<Arc<dyn InterruptSourceGroup>>,
) -> Result<()> {
if let Some(irq_info) = self.device.get_irq_info(VFIO_PCI_INTX_IRQ_INDEX) {
if irq_info.count == 0 {