cargo clippy

This commit is contained in:
2026-02-16 21:37:56 +08:00
parent 279ac11c0e
commit 08e09ab84c
5 changed files with 6 additions and 24 deletions

View File

@@ -56,7 +56,7 @@ pub async fn update_doll(id: String, dto: UpdateDollDto) -> Result<DollDto, Stri
#[tauri::command]
pub async fn delete_doll(id: String) -> Result<(), String> {
let result = DollsRemote::new()
DollsRemote::new()
.delete_doll(&id)
.await
.map_err(|e| e.to_string())?;
@@ -69,7 +69,7 @@ pub async fn delete_doll(id: String) -> Result<(), String> {
is_active.then_some(&[AppDataRefreshScope::User, AppDataRefreshScope::Friends]),
).await;
Ok(result)
Ok(())
}
#[tauri::command]

View File

@@ -27,7 +27,7 @@ fn get_module_metadata(path: &std::path::Path) -> Option<ModuleMetadata> {
metadata.name, metadata.version, metadata.description
);
return Some(metadata);
Some(metadata)
}
Err(e) => {
warn!("Failed to parse metadata.json in {}: {}", path.display(), e);

View File

@@ -66,7 +66,6 @@ pub fn spawn_lua_runtime(script: &str) -> thread::JoinHandle<()> {
if let Err(e) = lua.load(&script).exec() {
error!("Failed to execute lua script: {}", e);
return;
}
})
}

View File

@@ -12,20 +12,12 @@ use tracing::{error, info, warn};
static REFRESH_LOCK: once_cell::sync::Lazy<Mutex<()>> =
once_cell::sync::Lazy::new(|| Mutex::new(()));
#[derive(Default)]
pub struct AuthState {
pub auth_pass: Option<AuthPass>,
pub background_refresh_token: Option<tokio_util::sync::CancellationToken>,
}
impl Default for AuthState {
fn default() -> Self {
Self {
auth_pass: None,
background_refresh_token: None,
}
}
}
pub fn init_auth_state() -> AuthState {
let auth_pass = match load_auth_pass() {
Ok(pass) => pass,
@@ -46,9 +38,7 @@ pub fn init_auth_state() -> AuthState {
/// Automatically refreshes if expired and clears session on refresh failure.
pub async fn get_auth_pass_with_refresh() -> Option<AuthPass> {
info!("Retrieving tokens");
let Some(auth_pass) = ({ lock_r!(FDOLL).auth.auth_pass.clone() }) else {
return None;
};
let auth_pass = lock_r!(FDOLL).auth.auth_pass.clone()?;
let Some(issued_at) = auth_pass.issued_at else {
warn!("Auth pass missing issued_at timestamp, clearing");

View File

@@ -6,19 +6,12 @@ pub struct Clients {
pub ws_emit_failures: u8,
}
#[derive(Default)]
pub struct NetworkState {
pub clients: Option<Clients>,
pub health_monitor_token: Option<tokio_util::sync::CancellationToken>,
}
impl Default for NetworkState {
fn default() -> Self {
Self {
clients: None,
health_monitor_token: None,
}
}
}
pub fn init_network_state() -> NetworkState {
let http_client = reqwest::ClientBuilder::new()