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<libc::clockid_t> 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 <robert.bradford@intel.com>
This commit is contained in:
Rob Bradford 2021-03-25 17:01:21 +00:00
parent 3671f5e94c
commit 4da6bcd5d5

View File

@ -70,9 +70,9 @@ pub enum ClockType {
ThreadCpu, ThreadCpu,
} }
impl Into<libc::clockid_t> for ClockType { impl From<ClockType> for libc::clockid_t {
fn into(self) -> libc::clockid_t { fn from(ct: ClockType) -> libc::clockid_t {
match self { match ct {
ClockType::Monotonic => libc::CLOCK_MONOTONIC, ClockType::Monotonic => libc::CLOCK_MONOTONIC,
ClockType::Real => libc::CLOCK_REALTIME, ClockType::Real => libc::CLOCK_REALTIME,
ClockType::ProcessCpu => libc::CLOCK_PROCESS_CPUTIME_ID, ClockType::ProcessCpu => libc::CLOCK_PROCESS_CPUTIME_ID,