Skip to content

Commit

Permalink
fix(clippy): direct implementation of ToString
Browse files Browse the repository at this point in the history
  • Loading branch information
notmandatory committed May 29, 2024
1 parent def31bb commit c50a409
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#[cfg(test)]
#[macro_use]
extern crate serial_test;
extern crate core;

pub use interface::HWIClient;

Expand Down
11 changes: 7 additions & 4 deletions src/types.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
use core::fmt;
use std::convert::TryFrom;
use std::fmt::{Display, Formatter};
use std::ops::Deref;
use std::str::FromStr;

Expand Down Expand Up @@ -260,9 +262,9 @@ where
}
}

impl ToString for HWIDeviceType {
fn to_string(&self) -> String {
match self {
impl Display for HWIDeviceType {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
let name = match self {
Self::Ledger => String::from("ledger"),
Self::Trezor => String::from("trezor"),
Self::BitBox01 => String::from("digitalbitbox"),
Expand All @@ -271,7 +273,8 @@ impl ToString for HWIDeviceType {
Self::Coldcard => String::from("coldcard"),
Self::Jade => String::from("jade"),
Self::Other(name) => name.to_string(),
}
};
fmt::Display::fmt(&name, f)
}
}

Expand Down

0 comments on commit c50a409

Please sign in to comment.