chore: Run clippy fix pedantic

Signed-off-by: quexeky <git@quexeky.dev>
This commit is contained in:
quexeky
2025-08-01 08:42:45 +10:00
parent b5a8543194
commit 574782f445
21 changed files with 86 additions and 98 deletions

View File

@ -115,7 +115,7 @@ impl GameDownloadAgent {
);
let res = self
.run()
.map_err(|_| ApplicationDownloadError::DownloadError);
.map_err(|()| ApplicationDownloadError::DownloadError);
debug!(
"{} took {}ms to download",
@ -322,7 +322,7 @@ impl GameDownloadAgent {
}
});
let newly_completed = completed_contexts.to_owned();
let newly_completed = completed_contexts.clone();
let completed_lock_len = {
let mut context_map_lock = self.context_map.lock().unwrap();
@ -338,7 +338,7 @@ impl GameDownloadAgent {
.map(|x| {
(
x.checksum.clone(),
context_map_lock.get(&x.checksum).cloned().unwrap_or(false),
context_map_lock.get(&x.checksum).copied().unwrap_or(false),
)
})
.collect::<Vec<(String, bool)>>();

View File

@ -151,7 +151,7 @@ pub fn download_game_chunk(
return Err(ApplicationDownloadError::Communication(
RemoteAccessError::InvalidResponse(err),
));
};
}
return Err(ApplicationDownloadError::Communication(
RemoteAccessError::UnparseableResponse(raw_res),
));
@ -187,7 +187,7 @@ pub fn download_game_chunk(
.map_err(|e| ApplicationDownloadError::IoError(e.kind()))?;
if !completed {
return Ok(false);
};
}
// If we complete the file, set the permissions (if on Linux)
#[cfg(unix)]

View File

@ -38,12 +38,9 @@ pub mod v1 {
impl DropData {
pub fn generate(game_id: String, game_version: String, base_path: PathBuf) -> Self {
let mut file = match File::open(base_path.join(DROP_DATA_PATH)) {
Ok(file) => file,
Err(_) => {
debug!("Generating new dropdata for game {game_id}");
return DropData::new(game_id, game_version, base_path);
}
let mut file = if let Ok(file) = File::open(base_path.join(DROP_DATA_PATH)) { file } else {
debug!("Generating new dropdata for game {game_id}");
return DropData::new(game_id, game_version, base_path);
};
let mut s = Vec::new();
@ -53,7 +50,7 @@ impl DropData {
error!("{e}");
return DropData::new(game_id, game_version, base_path);
}
};
}
match native_model::rmp_serde_1_3::RmpSerde::decode(s) {
Ok(manifest) => manifest,
@ -78,9 +75,9 @@ impl DropData {
};
match file.write_all(&manifest_raw) {
Ok(_) => {}
Ok(()) => {}
Err(e) => error!("{e}"),
};
}
}
pub fn set_contexts(&self, completed_contexts: &[(String, bool)]) {
*self.contexts.lock().unwrap() = completed_contexts.iter().map(|s| (s.0.clone(), s.1)).collect();

View File

@ -125,7 +125,7 @@ pub fn validate_game_chunk(
validate_copy(&mut source, &mut hasher, ctx.length, control_flag, progress).unwrap();
if !completed {
return Ok(false);
};
}
let res = hex::encode(hasher.compute().0);
if res != ctx.checksum {

View File

@ -96,7 +96,7 @@ pub fn fetch_library_logic(
let mut db_handle = borrow_db_mut_checked();
for game in games.iter() {
for game in &games {
handle.games.insert(game.id.clone(), game.clone());
if !db_handle.applications.game_statuses.contains_key(&game.id) {
db_handle
@ -329,37 +329,34 @@ pub fn uninstall_game_logic(meta: DownloadableMetadata, app_handle: &AppHandle)
drop(db_handle);
let app_handle = app_handle.clone();
spawn(move || match remove_dir_all(install_dir) {
Err(e) => {
error!("{e}");
}
Ok(_) => {
let mut db_handle = borrow_db_mut_checked();
db_handle.applications.transient_statuses.remove(&meta);
db_handle
.applications
.installed_game_version
.remove(&meta.id);
db_handle
.applications
.game_statuses
.entry(meta.id.clone())
.and_modify(|e| *e = GameDownloadStatus::Remote {});
drop(db_handle);
spawn(move || if let Err(e) = remove_dir_all(install_dir) {
error!("{e}");
} else {
let mut db_handle = borrow_db_mut_checked();
db_handle.applications.transient_statuses.remove(&meta);
db_handle
.applications
.installed_game_version
.remove(&meta.id);
db_handle
.applications
.game_statuses
.entry(meta.id.clone())
.and_modify(|e| *e = GameDownloadStatus::Remote {});
drop(db_handle);
debug!("uninstalled game id {}", &meta.id);
app_handle.emit("update_library", ()).unwrap();
debug!("uninstalled game id {}", &meta.id);
app_handle.emit("update_library", ()).unwrap();
push_game_update(
&app_handle,
&meta.id,
None,
(Some(GameDownloadStatus::Remote {}), None),
);
}
push_game_update(
&app_handle,
&meta.id,
None,
(Some(GameDownloadStatus::Remote {}), None),
);
});
} else {
warn!("invalid previous state for uninstall, failing silently.")
warn!("invalid previous state for uninstall, failing silently.");
}
}