From e29468890415af95fa0cda4fe758f272356d6e42 Mon Sep 17 00:00:00 2001 From: Rob Bradford Date: Thu, 25 Mar 2021 17:01:21 +0000 Subject: [PATCH] hypervisor: Address Rust 1.51.0 clippy issue (from_over_into) warning: an implementation of `From` is preferred since it gives you `Into<_>` for free where the reverse isn't true --> hypervisor/src/vm.rs:41:1 | 41 | impl Into for DataMatch { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `#[warn(clippy::from_over_into)]` on by default = help: consider to implement `From` instead = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#from_over_into warning: 1 warning emitted Signed-off-by: Rob Bradford --- hypervisor/src/vm.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hypervisor/src/vm.rs b/hypervisor/src/vm.rs index de3d2c27d..f2ba97a44 100644 --- a/hypervisor/src/vm.rs +++ b/hypervisor/src/vm.rs @@ -38,9 +38,9 @@ pub enum DataMatch { DataMatch64(u64), } -impl Into for DataMatch { - fn into(self) -> u64 { - match self { +impl From for u64 { + fn from(dm: DataMatch) -> u64 { + match dm { DataMatch::DataMatch32(dm) => dm.into(), DataMatch::DataMatch64(dm) => dm, }