mirror of
https://github.com/Grasscutters/Cultivation.git
synced 2025-12-15 08:34:43 +01:00
Fix clippy lints
This commit is contained in:
@@ -54,17 +54,17 @@ pub async fn download_file(window: tauri::Window, url: &str, path: &str) -> Resu
|
||||
let chunk = match item {
|
||||
Ok(itm) => itm,
|
||||
Err(e) => {
|
||||
emit_download_err(window, format!("Error while downloading file"), path);
|
||||
emit_download_err(window, "Error while downloading file".to_string(), path);
|
||||
return Err(format!("Error while downloading file: {}", e));
|
||||
}
|
||||
};
|
||||
let vect = &chunk.to_vec()[..];
|
||||
|
||||
// Write bytes
|
||||
match file.write_all(&vect) {
|
||||
match file.write_all(vect) {
|
||||
Ok(x) => x,
|
||||
Err(e) => {
|
||||
emit_download_err(window, format!("Error while writing file"), path);
|
||||
emit_download_err(window, "Error while writing file".to_string(), path);
|
||||
return Err(format!("Error while writing file: {}", e));
|
||||
}
|
||||
}
|
||||
@@ -73,7 +73,7 @@ pub async fn download_file(window: tauri::Window, url: &str, path: &str) -> Resu
|
||||
let new = min(downloaded + (chunk.len() as u64), total_size);
|
||||
downloaded = new;
|
||||
|
||||
total_downloaded = total_downloaded + chunk.len() as u64;
|
||||
total_downloaded += chunk.len() as u64;
|
||||
|
||||
let mut res_hash = std::collections::HashMap::new();
|
||||
|
||||
@@ -105,15 +105,15 @@ pub async fn download_file(window: tauri::Window, url: &str, path: &str) -> Resu
|
||||
window.emit("download_finished", &path).unwrap();
|
||||
|
||||
// We are done
|
||||
return Ok(());
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn emit_download_err(window: tauri::Window, msg: std::string::String, path: &str) {
|
||||
pub fn emit_download_err(window: tauri::Window, msg: String, path: &str) {
|
||||
let mut res_hash = std::collections::HashMap::new();
|
||||
|
||||
res_hash.insert(
|
||||
"error".to_string(),
|
||||
msg.to_string(),
|
||||
msg,
|
||||
);
|
||||
|
||||
res_hash.insert(
|
||||
|
||||
Reference in New Issue
Block a user