applied basic cargo clippy suggestions

This commit is contained in:
2026-01-15 17:21:40 +08:00
parent a20b363d07
commit f9b220c558
5 changed files with 13 additions and 19 deletions

View File

@@ -7,7 +7,7 @@ use crate::{
#[tauri::command] #[tauri::command]
pub fn get_app_data() -> Result<AppData, String> { pub fn get_app_data() -> Result<AppData, String> {
let guard = lock_r!(FDOLL); let guard = lock_r!(FDOLL);
return Ok(guard.app_data.clone()); Ok(guard.app_data.clone())
} }
#[tauri::command] #[tauri::command]

View File

@@ -91,15 +91,12 @@ fn setup_fdoll() -> Result<(), tauri::Error> {
} }
fn register_app_events(event: tauri::RunEvent) { fn register_app_events(event: tauri::RunEvent) {
match event { if let tauri::RunEvent::ExitRequested { api, code, .. } = event {
tauri::RunEvent::ExitRequested { api, code, .. } => { if code.is_none() {
if code.is_none() { api.prevent_exit();
api.prevent_exit(); } else {
} else { println!("exit code: {:?}", code);
println!("exit code: {:?}", code);
}
} }
_ => {}
} }
} }

View File

@@ -38,7 +38,6 @@ pub fn open_app_menu_window() {
} }
Err(e) => { Err(e) => {
error!("Failed to build {} window: {}", APP_MENU_WINDOW_LABEL, e); error!("Failed to build {} window: {}", APP_MENU_WINDOW_LABEL, e);
return;
} }
}; }
} }

View File

@@ -108,7 +108,7 @@ fn generate_code_challenge(code_verifier: &str) -> String {
let mut hasher = Sha256::new(); let mut hasher = Sha256::new();
hasher.update(code_verifier.as_bytes()); hasher.update(code_verifier.as_bytes());
let result = hasher.finalize(); let result = hasher.finalize();
URL_SAFE_NO_PAD.encode(&result) URL_SAFE_NO_PAD.encode(result)
} }
/// Returns the auth pass object, including /// Returns the auth pass object, including
@@ -609,7 +609,7 @@ where
let bind_addr = "localhost:0"; let bind_addr = "localhost:0";
info!("Attempting to bind to: {}", bind_addr); info!("Attempting to bind to: {}", bind_addr);
let std_listener = match std::net::TcpListener::bind(&bind_addr) { let std_listener = match std::net::TcpListener::bind(bind_addr) {
Ok(s) => { Ok(s) => {
s.set_nonblocking(true).unwrap(); s.set_nonblocking(true).unwrap();
s s
@@ -695,10 +695,10 @@ where
if let Err(e) = app_handle.opener().open_url(url, None::<&str>) { if let Err(e) = app_handle.opener().open_url(url, None::<&str>) {
error!("Failed to open auth portal: {}", e); error!("Failed to open auth portal: {}", e);
return Err(OAuthError::OpenPortalFailed(e)); Err(OAuthError::OpenPortalFailed(e))
} else { } else {
info!("Successfully called open_url for auth portal"); info!("Successfully called open_url for auth portal");
return Ok(()); Ok(())
} }
} }

View File

@@ -86,10 +86,8 @@ pub async fn open_doll_editor_window(doll_id: Option<String>) {
if let Err(e) = window.emit("edit-doll", id) { if let Err(e) = window.emit("edit-doll", id) {
error!("Failed to emit edit-doll event: {}", e); error!("Failed to emit edit-doll event: {}", e);
} }
} else { } else if let Err(e) = window.emit("create-doll", ()) {
if let Err(e) = window.emit("create-doll", ()) { error!("Failed to emit create-doll event: {}", e);
error!("Failed to emit create-doll event: {}", e);
}
} }
return; return;