Skip to content

Commit

Permalink
chore: clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
noaione committed Jan 5, 2024
1 parent 78f081c commit 627bb7b
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 37 deletions.
50 changes: 18 additions & 32 deletions tosho/src/impl/kmkc/accounts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,9 @@ pub(crate) async fn kmkc_account_login_web(
Ok(account) => {
console.info(&cformat!("Authenticated as <m,s>{}</>", account.name));
let old_config = all_configs.iter().find(|&c| match c {
crate::config::ConfigImpl::Kmkc(c) => match c {
super::config::Config::Web(cc) => {
cc.account_id == account.id && cc.device_id == account.user_id
}
_ => false,
},
crate::config::ConfigImpl::Kmkc(super::config::Config::Web(cc)) => {
cc.account_id == account.id && cc.device_id == account.user_id
}
_ => false,
});

Expand All @@ -105,12 +102,9 @@ pub(crate) async fn kmkc_account_login_web(
}

match old_config {
crate::config::ConfigImpl::Kmkc(c) => match c {
super::config::Config::Web(cc) => {
acc_config = acc_config.with_id(cc.id.clone());
}
_ => unreachable!(),
},
crate::config::ConfigImpl::Kmkc(super::config::Config::Web(cc)) => {
acc_config = acc_config.with_id(cc.id.clone());
}
_ => unreachable!(),
}
}
Expand Down Expand Up @@ -145,10 +139,9 @@ pub(crate) async fn kmkc_account_login_mobile(

// find old config
let old_config = all_configs.iter().find(|&c| match c {
crate::config::ConfigImpl::Kmkc(c) => match c {
super::config::Config::Mobile(cc) => cc.device_id == user_id,
_ => false,
},
crate::config::ConfigImpl::Kmkc(super::config::Config::Mobile(cc)) => {
cc.device_id == user_id
}
_ => false,
});

Expand All @@ -162,12 +155,9 @@ pub(crate) async fn kmkc_account_login_mobile(
}

match old_config {
crate::config::ConfigImpl::Kmkc(c) => match c {
super::config::Config::Mobile(cc) => {
old_id = Some(cc.id.clone());
}
_ => unreachable!(),
},
crate::config::ConfigImpl::Kmkc(super::config::Config::Mobile(cc)) => {
old_id = Some(cc.id.clone());
}
_ => unreachable!(),
}
}
Expand Down Expand Up @@ -219,10 +209,9 @@ pub async fn kmkc_account_login(

// find old config
let old_config = all_configs.iter().find(|&c| match c {
crate::config::ConfigImpl::Kmkc(c) => match c {
super::config::Config::Mobile(cc) => cc.email == email && platform == cc.platform(),
_ => false,
},
crate::config::ConfigImpl::Kmkc(super::config::Config::Mobile(cc)) => {
cc.email == email && platform == cc.platform()
}
_ => false,
});

Expand All @@ -236,12 +225,9 @@ pub async fn kmkc_account_login(
}

match old_config {
crate::config::ConfigImpl::Kmkc(c) => match c {
super::config::Config::Mobile(cc) => {
old_id = Some(cc.id.clone());
}
_ => unreachable!(),
},
crate::config::ConfigImpl::Kmkc(super::config::Config::Mobile(cc)) => {
old_id = Some(cc.id.clone());
}
_ => unreachable!(),
}
}
Expand Down
5 changes: 1 addition & 4 deletions tosho/src/impl/kmkc/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,7 @@ pub(super) fn select_single_account(account_id: Option<&str>) -> Option<Config>
value: format!("{} [{}]", cc.id, cc.r#type().to_name()),
},
}),
crate::config::ConfigImpl::Musq(c) => Some(ConsoleChoice {
name: c.id.clone(),
value: format!("{} [{}]", c.id, c.r#type().to_name()),
}),
_ => None,
})
.collect();
if all_configs.is_empty() {
Expand Down
2 changes: 1 addition & 1 deletion tosho_kmkc/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ impl TryFrom<String> for KMConfigWeb {
let mut privacy = KMConfigWebKV::default();

for cookie_line in value.lines() {
if cookie_line.starts_with("#") && !cookie_line.starts_with("#HttpOnly_") {
if cookie_line.starts_with('#') && !cookie_line.starts_with("#HttpOnly_") {
continue;
}

Expand Down

0 comments on commit 627bb7b

Please sign in to comment.