clippy: apply and fix new lints
This commit is contained in:
@@ -58,6 +58,7 @@ impl From<EtiGame> for Game {
|
|||||||
max_players: eti_game.game_maxplayers,
|
max_players: eti_game.game_maxplayers,
|
||||||
version: eti_game.game_version,
|
version: eti_game.game_version,
|
||||||
genre: eti_game.genre_de,
|
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,
|
size: (eti_game.game_size * 1024.0 * 1024.0 * 1024.0) as u64,
|
||||||
thumbnail: None,
|
thumbnail: None,
|
||||||
installed: false,
|
installed: false,
|
||||||
|
@@ -1,3 +1,5 @@
|
|||||||
|
#![allow(clippy::missing_errors_doc, clippy::missing_panics_doc)]
|
||||||
|
|
||||||
use std::net::SocketAddr;
|
use std::net::SocketAddr;
|
||||||
|
|
||||||
use eyre::bail;
|
use eyre::bail;
|
||||||
|
@@ -21,6 +21,7 @@ unsafe_code = "forbid"
|
|||||||
pedantic = { level = "warn", priority = -1 }
|
pedantic = { level = "warn", priority = -1 }
|
||||||
todo = "warn"
|
todo = "warn"
|
||||||
unwrap_used = "warn"
|
unwrap_used = "warn"
|
||||||
|
needless_pass_by_value = "allow"
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
tauri-build = { version = "2", features = [] }
|
tauri-build = { version = "2", features = [] }
|
||||||
|
@@ -1,3 +1,3 @@
|
|||||||
fn main() {
|
fn main() {
|
||||||
tauri_build::build()
|
tauri_build::build();
|
||||||
}
|
}
|
||||||
|
@@ -171,7 +171,7 @@ fn update_game_directory(app_handle: tauri::AppHandle, path: String) {
|
|||||||
.state::<LanSpreadState>()
|
.state::<LanSpreadState>()
|
||||||
.client_ctrl
|
.client_ctrl
|
||||||
.send(ClientCommand::SetGameDir(path.clone()))
|
.send(ClientCommand::SetGameDir(path.clone()))
|
||||||
.unwrap();
|
.expect("Failed to send ClientCommand: SetGameDir");
|
||||||
|
|
||||||
{
|
{
|
||||||
tauri::async_runtime::block_on(async {
|
tauri::async_runtime::block_on(async {
|
||||||
@@ -182,13 +182,13 @@ fn update_game_directory(app_handle: tauri::AppHandle, path: String) {
|
|||||||
.write()
|
.write()
|
||||||
.await;
|
.await;
|
||||||
|
|
||||||
*games_folder = path.clone();
|
games_folder.clone_from(&path);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
let path = PathBuf::from(path);
|
let path = PathBuf::from(path);
|
||||||
if !path.exists() {
|
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() {
|
let entries = match path.read_dir() {
|
||||||
@@ -241,7 +241,7 @@ async fn find_server(app: AppHandle) {
|
|||||||
state
|
state
|
||||||
.client_ctrl
|
.client_ctrl
|
||||||
.send(ClientCommand::ServerAddr(server_addr))
|
.send(ClientCommand::ServerAddr(server_addr))
|
||||||
.unwrap();
|
.expect("Failed to send ClientCommand: ServerAddr");
|
||||||
request_games(state);
|
request_games(state);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -312,11 +312,10 @@ async fn do_unrar(sidecar: Command, rar_file: &Path, dest_dir: &Path) -> eyre::R
|
|||||||
}
|
}
|
||||||
|
|
||||||
return Ok(());
|
return Ok(());
|
||||||
} else {
|
|
||||||
log::error!("dest_dir canonicalize failed: {:?}", &dest_dir);
|
|
||||||
}
|
}
|
||||||
|
log::error!("dest_dir canonicalize failed: {}", dest_dir.display());
|
||||||
} else {
|
} 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");
|
let local_path = game_path.join("local");
|
||||||
|
|
||||||
if let Err(e) = do_unrar(sidecar, &eti_rar, &local_path).await {
|
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)]
|
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
||||||
pub fn run() {
|
pub fn run() {
|
||||||
let tauri_logger_builder = tauri_plugin_log::Builder::new()
|
let tauri_logger_builder = tauri_plugin_log::Builder::new()
|
||||||
@@ -356,7 +357,7 @@ pub fn run() {
|
|||||||
client_ctrl: tx_client_control,
|
client_ctrl: tx_client_control,
|
||||||
games: Arc::new(RwLock::new(GameDB::empty())),
|
games: Arc::new(RwLock::new(GameDB::empty())),
|
||||||
games_in_download: Arc::new(Mutex::new(HashSet::new())),
|
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()
|
tauri::Builder::default()
|
||||||
@@ -405,7 +406,7 @@ pub fn run() {
|
|||||||
id,
|
id,
|
||||||
file_descriptions,
|
file_descriptions,
|
||||||
})
|
})
|
||||||
.unwrap();
|
.expect("Failed to send ClientCommand: DownloadGameFiles");
|
||||||
|
|
||||||
}
|
}
|
||||||
ClientEvent::DownloadGameFilesBegin { id } => {
|
ClientEvent::DownloadGameFilesBegin { id } => {
|
||||||
|
@@ -7,5 +7,5 @@ use mimalloc::MiMalloc;
|
|||||||
static GLOBAL: MiMalloc = MiMalloc;
|
static GLOBAL: MiMalloc = MiMalloc;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
lanspread_tauri_deno_ts_lib::run()
|
lanspread_tauri_deno_ts_lib::run();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user