Skip to content

Commit d675ae2

Browse files
committed
fix: clippy
1 parent cce97ac commit d675ae2

File tree

1 file changed

+21
-10
lines changed

1 file changed

+21
-10
lines changed

src/types.rs

+21-10
Original file line numberDiff line numberDiff line change
@@ -260,17 +260,28 @@ where
260260
}
261261
}
262262

263-
impl ToString for HWIDeviceType {
264-
fn to_string(&self) -> String {
263+
struct Point {
264+
x: usize,
265+
y: usize,
266+
}
267+
268+
impl std::fmt::Display for Point {
269+
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
270+
write!(f, "({}, {})", self.x, self.y)
271+
}
272+
}
273+
274+
impl std::fmt::Display for HWIDeviceType {
275+
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
265276
match self {
266-
Self::Ledger => String::from("ledger"),
267-
Self::Trezor => String::from("trezor"),
268-
Self::BitBox01 => String::from("digitalbitbox"),
269-
Self::BitBox02 => String::from("bitbox02"),
270-
Self::KeepKey => String::from("keepkey"),
271-
Self::Coldcard => String::from("coldcard"),
272-
Self::Jade => String::from("jade"),
273-
Self::Other(name) => name.to_string(),
277+
HWIDeviceType::Ledger => write!(f, "ledger"),
278+
HWIDeviceType::Trezor => write!(f, "trezor"),
279+
HWIDeviceType::BitBox01 => write!(f, "digitalbitbox"),
280+
HWIDeviceType::BitBox02 => write!(f, "bitbox02"),
281+
HWIDeviceType::KeepKey => write!(f, "keepkey"),
282+
HWIDeviceType::Coldcard => write!(f, "coldcard"),
283+
HWIDeviceType::Jade => write!(f, "jade"),
284+
HWIDeviceType::Other(name) => write!(f, "{}", name.to_string()),
274285
}
275286
}
276287
}

0 commit comments

Comments
 (0)