From 2924f8bfb713bea5d684f051e7da366255b4d13a Mon Sep 17 00:00:00 2001 From: Daniel Verkamp Date: Fri, 30 Apr 2021 12:42:15 -0700 Subject: [PATCH] kernel_cmdline, cros_async: impl From instead of Into As recommended by the clippy from_over_into warning, allow conversion to Vec by adding a more flexible From impl instead of Into. https://rust-lang.github.io/rust-clippy/master/index.html#from_over_into BUG=None TEST=bin/clippy Change-Id: Iaa6455b11629846e5ce9bc9be4a6cae0baf87d5b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2862580 Reviewed-by: Zach Reizner Tested-by: Daniel Verkamp Commit-Queue: Daniel Verkamp --- cros_async/src/mem.rs | 6 +++--- kernel_cmdline/src/kernel_cmdline.rs | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cros_async/src/mem.rs b/cros_async/src/mem.rs index f90df470d8..bf612b7dee 100644 --- a/cros_async/src/mem.rs +++ b/cros_async/src/mem.rs @@ -68,9 +68,9 @@ impl From> for VecIoWrapper { } } -impl Into> for VecIoWrapper { - fn into(self) -> Vec { - self.inner.into() +impl From for Vec { + fn from(v: VecIoWrapper) -> Vec { + v.inner.into() } } diff --git a/kernel_cmdline/src/kernel_cmdline.rs b/kernel_cmdline/src/kernel_cmdline.rs index c836e12623..ad040ecdda 100644 --- a/kernel_cmdline/src/kernel_cmdline.rs +++ b/kernel_cmdline/src/kernel_cmdline.rs @@ -139,9 +139,9 @@ impl Cmdline { } } -impl Into> for Cmdline { - fn into(self) -> Vec { - self.line.into_bytes() +impl From for Vec { + fn from(c: Cmdline) -> Vec { + c.line.into_bytes() } }