Fix clippy warnings

This commit is contained in:
Bilal Elmoussaoui 2024-07-19 20:25:34 +02:00
parent 6ca505900c
commit 78b398972e
4 changed files with 15 additions and 20 deletions

View file

@ -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(" "));

View file

@ -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()
}
}

View file

@ -156,7 +156,7 @@ impl From<OTPUri> 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),

View file

@ -9,7 +9,7 @@ pub struct SearchProvider {
}
pub enum SearchProviderAction {
LaunchSearch(Vec<String>, u32),
LaunchSearch(Vec<String>),
ActivateResult(ResultID),
InitialResultSet(Vec<String>, futures_channel::oneshot::Sender<Vec<ResultID>>),
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<ResultID> {