cargo fmt

This commit is contained in:
beerpiss 2024-06-29 00:42:42 +07:00
parent 3c938c7ef3
commit 62764997ce
5 changed files with 82 additions and 79 deletions

View File

@ -6,8 +6,8 @@ use serde::{Deserialize, Serialize};
use snafu::{prelude::Snafu, ResultExt}; use snafu::{prelude::Snafu, ResultExt};
use crate::{ use crate::{
consts::USER_AGENT,
config::SaekawaConfig, config::SaekawaConfig,
consts::USER_AGENT,
types::tachi::{ types::tachi::{
api::{TachiFailureResponse, TachiResponse}, api::{TachiFailureResponse, TachiResponse},
api_returns::{ImportPollStatus, ImportResponse}, api_returns::{ImportPollStatus, ImportResponse},

View File

@ -32,7 +32,7 @@ where
mod serde_user_play_date { mod serde_user_play_date {
use chrono::NaiveDateTime; use chrono::NaiveDateTime;
use serde::{ser, de}; use serde::{de, ser};
const DT_FORMAT: &str = "%Y-%m-%d %H:%M:%S"; const DT_FORMAT: &str = "%Y-%m-%d %H:%M:%S";
@ -64,8 +64,7 @@ mod serde_user_play_date {
where where
E: de::Error, E: de::Error,
{ {
NaiveDateTime::parse_from_str(v, DT_FORMAT) NaiveDateTime::parse_from_str(v, DT_FORMAT).map_err(E::custom)
.map_err(E::custom)
} }
} }
} }

View File

@ -26,7 +26,7 @@ pub struct UserData {
#[serde( #[serde(
default = "default_class_emblem", default = "default_class_emblem",
deserialize_with = "deserialize_option_number_from_string", deserialize_with = "deserialize_option_number_from_string"
)] )]
pub class_emblem_base: Option<u32>, pub class_emblem_base: Option<u32>,

View File

@ -58,7 +58,9 @@ impl UserPlaylog {
}; };
let jst_offset = FixedOffset::east_opt(9 * 3600).expect("chrono should parse JST timezone"); let jst_offset = FixedOffset::east_opt(9 * 3600).expect("chrono should parse JST timezone");
let jst_time = jst_offset.from_local_datetime(&self.user_play_date).unwrap(); let jst_time = jst_offset
.from_local_datetime(&self.user_play_date)
.unwrap();
Ok(BatchManualScore { Ok(BatchManualScore {
score: self.score, score: self.score,

View File

@ -18,7 +18,8 @@ use winapi::{
minwindef::{BOOL, DWORD, HMODULE, LPVOID, PROC}, minwindef::{BOOL, DWORD, HMODULE, LPVOID, PROC},
ntdef::{LPCWSTR, LPSTR}, ntdef::{LPCWSTR, LPSTR},
winerror::{ winerror::{
CERT_E_CHAINING, CERT_E_EXPIRED, CERT_E_UNTRUSTEDROOT, CRYPT_E_SECURITY_SETTINGS, TRUST_E_BAD_DIGEST, TRUST_E_EXPLICIT_DISTRUST, TRUST_E_NOSIGNATURE CERT_E_CHAINING, CERT_E_EXPIRED, CERT_E_UNTRUSTEDROOT, CRYPT_E_SECURITY_SETTINGS,
TRUST_E_BAD_DIGEST, TRUST_E_EXPLICIT_DISTRUST, TRUST_E_NOSIGNATURE,
}, },
}, },
um::{ um::{
@ -172,9 +173,7 @@ struct UpdateInformation {
/// and the hook should uninject itself so a newer version can load in. /// and the hook should uninject itself so a newer version can load in.
#[allow(clippy::result_large_err)] #[allow(clippy::result_large_err)]
pub fn self_update(module: &LibraryHandle) -> Result<bool, SelfUpdateError> { pub fn self_update(module: &LibraryHandle) -> Result<bool, SelfUpdateError> {
let agent = ureq::builder() let agent = ureq::builder().user_agent(USER_AGENT).build();
.user_agent(USER_AGENT)
.build();
info!("Checking for updates..."); info!("Checking for updates...");
let response = agent let response = agent
@ -371,7 +370,10 @@ pub fn self_update(module: &LibraryHandle) -> Result<bool, SelfUpdateError> {
let handle = CreateThread( let handle = CreateThread(
ptr::null_mut(), ptr::null_mut(),
0, 0,
Some(std::mem::transmute::<PROC, unsafe extern "system" fn(*mut winapi::ctypes::c_void) -> u32>(updater_start_address)), Some(std::mem::transmute::<
PROC,
unsafe extern "system" fn(*mut winapi::ctypes::c_void) -> u32,
>(updater_start_address)),
heap as *mut _, heap as *mut _,
0, 0,
ptr::null_mut(), ptr::null_mut(),