fmt: clippy and fmt

This commit is contained in:
silver 2023-10-26 23:06:59 +01:00
parent 1e9b49f459
commit ba06d1ec0b

View file

@ -122,12 +122,12 @@ struct WolvesResultUser {
requested: String, requested: String,
approved: String, approved: String,
sitename: String, sitename: String,
domain: String domain: String,
} }
#[derive(Deserialize, Serialize, Debug)] #[derive(Deserialize, Serialize, Debug)]
struct WolvesResult { struct WolvesResult {
success: i8, success: i8,
result: Vec<WolvesResultUser> result: Vec<WolvesResultUser>,
} }
async fn get_wolves(config: &Config) -> Vec<AccountWolves> { async fn get_wolves(config: &Config) -> Vec<AccountWolves> {
@ -137,23 +137,26 @@ async fn get_wolves(config: &Config) -> Vec<AccountWolves> {
if config.wolves_url.is_empty() { if config.wolves_url.is_empty() {
return vec![]; return vec![];
} }
// get wolves data // get wolves data
let uri = &config.wolves_url; let uri = &config.wolves_url;
let mut res = surf::post(uri).header("X-AM-Identity", &config.wolves_key).await.unwrap(); let mut res = surf::post(uri).header("X-AM-Identity", &config.wolves_key).await.unwrap();
if let Ok(WolvesResult { success, result }) = res.body_json().await { if let Ok(WolvesResult {
success,
result,
}) = res.body_json().await
{
if success != 1 { if success != 1 {
return vec![]; return vec![];
} }
return result.iter().map(|wolves| AccountWolves::from(wolves) ).collect::<Vec<AccountWolves>>(); return result.iter().map(AccountWolves::from).collect::<Vec<AccountWolves>>();
} }
vec![] vec![]
} }
async fn update_account(db: &Pool<Sqlite>, account: &AccountWolves) { async fn update_account(db: &Pool<Sqlite>, account: &AccountWolves) {
sqlx::query_as::<_, AccountWolves>( sqlx::query_as::<_, AccountWolves>(
" "