From d675ae23ff478a9a6e45c462adee2d5ab80c8b70 Mon Sep 17 00:00:00 2001 From: Leonardo Lima Date: Fri, 24 May 2024 17:54:02 -0300 Subject: [PATCH] fix: clippy --- src/types.rs | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/src/types.rs b/src/types.rs index 4f368ef..34db69d 100644 --- a/src/types.rs +++ b/src/types.rs @@ -260,17 +260,28 @@ where } } -impl ToString for HWIDeviceType { - fn to_string(&self) -> String { +struct Point { + x: usize, + y: usize, +} + +impl std::fmt::Display for Point { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "({}, {})", self.x, self.y) + } +} + +impl std::fmt::Display for HWIDeviceType { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { - Self::Ledger => String::from("ledger"), - Self::Trezor => String::from("trezor"), - Self::BitBox01 => String::from("digitalbitbox"), - Self::BitBox02 => String::from("bitbox02"), - Self::KeepKey => String::from("keepkey"), - Self::Coldcard => String::from("coldcard"), - Self::Jade => String::from("jade"), - Self::Other(name) => name.to_string(), + HWIDeviceType::Ledger => write!(f, "ledger"), + HWIDeviceType::Trezor => write!(f, "trezor"), + HWIDeviceType::BitBox01 => write!(f, "digitalbitbox"), + HWIDeviceType::BitBox02 => write!(f, "bitbox02"), + HWIDeviceType::KeepKey => write!(f, "keepkey"), + HWIDeviceType::Coldcard => write!(f, "coldcard"), + HWIDeviceType::Jade => write!(f, "jade"), + HWIDeviceType::Other(name) => write!(f, "{}", name.to_string()), } } }