From 5b51024ef7db64249064d3116309d78dfcd93ef7 Mon Sep 17 00:00:00 2001 From: Ravi kumar Veeramally Date: Mon, 26 Jun 2023 17:48:25 +0300 Subject: [PATCH] pci: Remove "from_over_into" clippy MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit According the std docs implementing From<..> is preferred since it gives you Into<..> for free where the reverse isn’t true. Signed-off-by: Ravi kumar Veeramally --- pci/src/configuration.rs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/pci/src/configuration.rs b/pci/src/configuration.rs index 2e714d04e..c89390fb6 100644 --- a/pci/src/configuration.rs +++ b/pci/src/configuration.rs @@ -452,10 +452,9 @@ impl From for PciBarRegionType { } } -#[allow(clippy::from_over_into)] -impl Into for PciBarRegionType { - fn into(self) -> PciBarType { - match self { +impl From for PciBarType { + fn from(val: PciBarRegionType) -> Self { + match val { PciBarRegionType::IoRegion => PciBarType::Io, PciBarRegionType::Memory32BitRegion => PciBarType::Mmio32, PciBarRegionType::Memory64BitRegion => PciBarType::Mmio64, @@ -469,10 +468,9 @@ pub enum PciBarPrefetchable { Prefetchable = 0x08, } -#[allow(clippy::from_over_into)] -impl Into for PciBarPrefetchable { - fn into(self) -> bool { - match self { +impl From for bool { + fn from(val: PciBarPrefetchable) -> Self { + match val { PciBarPrefetchable::NotPrefetchable => false, PciBarPrefetchable::Prefetchable => true, }