diff --git a/src/application.rs b/src/application.rs index e3529b4..c487e58 100644 --- a/src/application.rs +++ b/src/application.rs @@ -413,7 +413,7 @@ impl Application { loop { let response = receiver.next().await.unwrap(); match response { - SearchProviderAction::LaunchSearch(terms, _) => { + SearchProviderAction::LaunchSearch(terms) => { self.activate(); let window = self.active_window(); window.imp().search_entry.set_text(&terms.join(" ")); diff --git a/src/models/algorithm.rs b/src/models/algorithm.rs index dc2320f..ff681ad 100644 --- a/src/models/algorithm.rs +++ b/src/models/algorithm.rs @@ -77,14 +77,13 @@ impl FromStr for Method { } } -impl ToString for Method { - fn to_string(&self) -> String { +impl std::fmt::Display for Method { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match *self { - Self::TOTP => "totp", - Self::HOTP => "hotp", - Self::Steam => "steam", + Self::TOTP => write!(f, "totp"), + Self::HOTP => write!(f, "hotp"), + Self::Steam => write!(f, "steam"), } - .to_string() } } @@ -142,14 +141,13 @@ impl FromStr for Algorithm { } } -impl ToString for Algorithm { - fn to_string(&self) -> String { +impl std::fmt::Display for Algorithm { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match *self { - Self::SHA1 => "sha1", - Self::SHA256 => "sha256", - Self::SHA512 => "sha512", + Self::SHA1 => write!(f, "sha1"), + Self::SHA256 => write!(f, "sha256"), + Self::SHA512 => write!(f, "sha512"), } - .to_string() } } diff --git a/src/models/otp_uri.rs b/src/models/otp_uri.rs index 9a19077..d67fb31 100644 --- a/src/models/otp_uri.rs +++ b/src/models/otp_uri.rs @@ -156,7 +156,7 @@ impl From for String { fn from(val: OTPUri) -> Self { let mut otp_uri = format!( "otpauth://{}/{}?secret={}&issuer={}&algorithm={}", - val.method.to_string(), + val.method, utf8_percent_encode(&val.label, NON_ALPHANUMERIC), val.secret, utf8_percent_encode(&val.issuer, NON_ALPHANUMERIC), diff --git a/src/models/search_provider.rs b/src/models/search_provider.rs index 62575f3..1a5e035 100644 --- a/src/models/search_provider.rs +++ b/src/models/search_provider.rs @@ -9,7 +9,7 @@ pub struct SearchProvider { } pub enum SearchProviderAction { - LaunchSearch(Vec, u32), + LaunchSearch(Vec), ActivateResult(ResultID), InitialResultSet(Vec, futures_channel::oneshot::Sender>), ResultMetas( @@ -32,13 +32,10 @@ impl SearchProviderImpl for SearchProvider { .unbounded_send(SearchProviderAction::ActivateResult(identifier)); } - fn launch_search(&self, terms: &[String], timestamp: u32) { + fn launch_search(&self, terms: &[String], _timestamp: u32) { let _ = self .sender - .unbounded_send(SearchProviderAction::LaunchSearch( - terms.to_owned(), - timestamp, - )); + .unbounded_send(SearchProviderAction::LaunchSearch(terms.to_owned())); } fn initial_result_set(&self, terms: &[String]) -> Vec {