clippy: apply and fix new lints

This commit is contained in:
2025-08-17 16:35:54 +02:00
parent 61a41c7122
commit 3b19cb8b18
6 changed files with 17 additions and 12 deletions

View File

@@ -58,6 +58,7 @@ impl From<EtiGame> for Game {
max_players: eti_game.game_maxplayers,
version: eti_game.game_version,
genre: eti_game.genre_de,
#[allow(clippy::cast_sign_loss, clippy::cast_possible_truncation)]
size: (eti_game.game_size * 1024.0 * 1024.0 * 1024.0) as u64,
thumbnail: None,
installed: false,

View File

@@ -1,3 +1,5 @@
#![allow(clippy::missing_errors_doc, clippy::missing_panics_doc)]
use std::net::SocketAddr;
use eyre::bail;

View File

@@ -21,6 +21,7 @@ unsafe_code = "forbid"
pedantic = { level = "warn", priority = -1 }
todo = "warn"
unwrap_used = "warn"
needless_pass_by_value = "allow"
[build-dependencies]
tauri-build = { version = "2", features = [] }

View File

@@ -1,3 +1,3 @@
fn main() {
tauri_build::build()
tauri_build::build();
}

View File

@@ -171,7 +171,7 @@ fn update_game_directory(app_handle: tauri::AppHandle, path: String) {
.state::<LanSpreadState>()
.client_ctrl
.send(ClientCommand::SetGameDir(path.clone()))
.unwrap();
.expect("Failed to send ClientCommand: SetGameDir");
{
tauri::async_runtime::block_on(async {
@@ -182,13 +182,13 @@ fn update_game_directory(app_handle: tauri::AppHandle, path: String) {
.write()
.await;
*games_folder = path.clone();
games_folder.clone_from(&path);
});
}
let path = PathBuf::from(path);
if !path.exists() {
log::error!("game dir {path:?} does not exist");
log::error!("game dir {} does not exist", path.display());
}
let entries = match path.read_dir() {
@@ -241,7 +241,7 @@ async fn find_server(app: AppHandle) {
state
.client_ctrl
.send(ClientCommand::ServerAddr(server_addr))
.unwrap();
.expect("Failed to send ClientCommand: ServerAddr");
request_games(state);
break;
}
@@ -312,11 +312,10 @@ async fn do_unrar(sidecar: Command, rar_file: &Path, dest_dir: &Path) -> eyre::R
}
return Ok(());
} else {
log::error!("dest_dir canonicalize failed: {:?}", &dest_dir);
}
log::error!("dest_dir canonicalize failed: {}", dest_dir.display());
} else {
log::error!("rar_file canonicalize failed: {:?}", &rar_file);
log::error!("rar_file canonicalize failed: {}", rar_file.display());
}
}
@@ -329,10 +328,12 @@ async fn unpack_game(id: &str, sidecar: Command, games_folder: String) {
let local_path = game_path.join("local");
if let Err(e) = do_unrar(sidecar, &eti_rar, &local_path).await {
log::error!("{eti_rar:?} -> {local_path:?}: {e}");
log::error!("{} -> {}: {e}", eti_rar.display(), local_path.display());
}
}
#[allow(clippy::too_many_lines)]
#[allow(clippy::missing_panics_doc)]
#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() {
let tauri_logger_builder = tauri_plugin_log::Builder::new()
@@ -356,7 +357,7 @@ pub fn run() {
client_ctrl: tx_client_control,
games: Arc::new(RwLock::new(GameDB::empty())),
games_in_download: Arc::new(Mutex::new(HashSet::new())),
games_folder: Arc::new(RwLock::new("".to_string())),
games_folder: Arc::new(RwLock::new(String::new())),
};
tauri::Builder::default()
@@ -405,7 +406,7 @@ pub fn run() {
id,
file_descriptions,
})
.unwrap();
.expect("Failed to send ClientCommand: DownloadGameFiles");
}
ClientEvent::DownloadGameFilesBegin { id } => {

View File

@@ -7,5 +7,5 @@ use mimalloc::MiMalloc;
static GLOBAL: MiMalloc = MiMalloc;
fn main() {
lanspread_tauri_deno_ts_lib::run()
lanspread_tauri_deno_ts_lib::run();
}