From 4da6bcd5d59d32927fc1002c71a8e9e8a5a42717 Mon Sep 17 00:00:00 2001 From: Rob Bradford Date: Thu, 25 Mar 2021 17:01:21 +0000 Subject: [PATCH] aarch64: Address Rust 1.51.0 clippy issue (from_over_into) error: an implementation of `From` is preferred since it gives you `Into<_>` for free where the reverse isn't true Error: --> devices/src/legacy/rtc_pl031.rs:73:1 | 73 | impl Into for ClockType { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::from-over-into` implied by `-D warnings` = help: consider to implement `From` instead = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#from_over_into Signed-off-by: Rob Bradford --- devices/src/legacy/rtc_pl031.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/devices/src/legacy/rtc_pl031.rs b/devices/src/legacy/rtc_pl031.rs index 2c1e4d6bd..18ea32b27 100644 --- a/devices/src/legacy/rtc_pl031.rs +++ b/devices/src/legacy/rtc_pl031.rs @@ -70,9 +70,9 @@ pub enum ClockType { ThreadCpu, } -impl Into for ClockType { - fn into(self) -> libc::clockid_t { - match self { +impl From for libc::clockid_t { + fn from(ct: ClockType) -> libc::clockid_t { + match ct { ClockType::Monotonic => libc::CLOCK_MONOTONIC, ClockType::Real => libc::CLOCK_REALTIME, ClockType::ProcessCpu => libc::CLOCK_PROCESS_CPUTIME_ID,