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

View File

@@ -91,16 +91,13 @@ fn setup_fdoll() -> Result<(), tauri::Error> {
}
fn register_app_events(event: tauri::RunEvent) {
match event {
tauri::RunEvent::ExitRequested { api, code, .. } => {
if let tauri::RunEvent::ExitRequested { api, code, .. } = event {
if code.is_none() {
api.prevent_exit();
} else {
println!("exit code: {:?}", code);
}
}
_ => {}
}
}
#[cfg_attr(mobile, tauri::mobile_entry_point)]

View File

@@ -38,7 +38,6 @@ pub fn open_app_menu_window() {
}
Err(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();
hasher.update(code_verifier.as_bytes());
let result = hasher.finalize();
URL_SAFE_NO_PAD.encode(&result)
URL_SAFE_NO_PAD.encode(result)
}
/// Returns the auth pass object, including
@@ -609,7 +609,7 @@ where
let bind_addr = "localhost:0";
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) => {
s.set_nonblocking(true).unwrap();
s
@@ -695,10 +695,10 @@ where
if let Err(e) = app_handle.opener().open_url(url, None::<&str>) {
error!("Failed to open auth portal: {}", e);
return Err(OAuthError::OpenPortalFailed(e));
Err(OAuthError::OpenPortalFailed(e))
} else {
info!("Successfully called open_url for auth portal");
return Ok(());
Ok(())
}
}

View File

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