Skip to content

Commit 8a420c7

Browse files
committed
chore: Run cargo clippy && cargo fmt
Signed-off-by: quexeky <[email protected]>
1 parent 974666e commit 8a420c7

File tree

18 files changed

+71
-117
lines changed

18 files changed

+71
-117
lines changed

cloud_saves/src/resolver.rs

Lines changed: 4 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
11
use std::{
22
fs::{self, create_dir_all, File},
3-
io::{self, ErrorKind, Read, Write},
3+
io::{self, Read, Write},
44
path::{Path, PathBuf},
5-
thread::sleep,
6-
time::Duration,
75
};
86

97
use crate::error::BackupError;
108

119
use super::{
12-
backup_manager::BackupHandler, conditions::Condition, metadata::GameFile, placeholder::*,
10+
backup_manager::BackupHandler, placeholder::*,
1311
};
14-
use database::{platform::Platform, GameVersion};
12+
use database::GameVersion;
1513
use log::{debug, warn};
1614
use rustix::path::Arg;
1715
use tempfile::tempfile;
@@ -30,7 +28,6 @@ pub fn resolve(meta: &mut CloudSaveMetadata) -> File {
3028
.iter()
3129
.find_map(|p| match p {
3230
super::conditions::Condition::Os(os) => Some(os),
33-
_ => None,
3431
})
3532
.cloned()
3633
{
@@ -96,7 +93,6 @@ pub fn extract(file: PathBuf) -> Result<(), BackupError> {
9693
.iter()
9794
.find_map(|p| match p {
9895
super::conditions::Condition::Os(os) => Some(os),
99-
_ => None,
10096
})
10197
.cloned()
10298
{
@@ -218,44 +214,4 @@ pub fn parse_path(
218214

219215
println!("Final line: {:?}", &s);
220216
Ok(s)
221-
}
222-
223-
pub fn test() {
224-
let mut meta = CloudSaveMetadata {
225-
files: vec![
226-
GameFile {
227-
path: String::from("<home>/favicon.png"),
228-
id: None,
229-
data_type: super::metadata::DataType::File,
230-
tags: Vec::new(),
231-
conditions: vec![Condition::Os(Platform::Linux)],
232-
},
233-
GameFile {
234-
path: String::from("<home>/Documents/Pixel Art"),
235-
id: None,
236-
data_type: super::metadata::DataType::File,
237-
tags: Vec::new(),
238-
conditions: vec![Condition::Os(Platform::Linux)],
239-
},
240-
],
241-
game_version: GameVersion {
242-
game_id: String::new(),
243-
version_name: String::new(),
244-
platform: Platform::Linux,
245-
launch_command: String::new(),
246-
launch_args: Vec::new(),
247-
launch_command_template: String::new(),
248-
setup_command: String::new(),
249-
setup_args: Vec::new(),
250-
setup_command_template: String::new(),
251-
only_setup: true,
252-
version_index: 0,
253-
delta: false,
254-
umu_id_override: None,
255-
},
256-
save_id: String::from("aaaaaaa"),
257-
};
258-
//resolve(&mut meta);
259-
260-
extract("save".into()).unwrap();
261-
}
217+
}

download_manager/src/download_manager_builder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use std::{
99

1010
use database::DownloadableMetadata;
1111
use log::{debug, error, info, warn};
12-
use tauri::{AppHandle, Emitter};
12+
use tauri::AppHandle;
1313
use utils::{app_emit, lock, send};
1414

1515

download_manager/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#![feature(nonpoison_mutex)]
33
#![feature(sync_nonpoison)]
44

5-
use std::{ops::Deref, sync::{nonpoison::Mutex, LazyLock, OnceLock}};
5+
use std::{ops::Deref, sync::OnceLock};
66

77
use tauri::AppHandle;
88

games/src/downloads/download_agent.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use std::path::{Path, PathBuf};
1818
use std::sync::mpsc::Sender;
1919
use std::sync::{Arc, Mutex};
2020
use std::time::Instant;
21-
use tauri::{AppHandle, Emitter};
21+
use tauri::AppHandle;
2222

2323
#[cfg(target_os = "linux")]
2424
use rustix::fs::{FallocateFlags, fallocate};

games/src/downloads/download_logic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ impl DropWriter<File> {
4747

4848
fn finish(mut self) -> io::Result<Digest> {
4949
self.flush()?;
50-
Ok(self.hasher.compute())
50+
Ok(self.hasher.finalize())
5151
}
5252
}
5353
// Write automatically pushes to file and hasher

games/src/downloads/validate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ pub fn validate_game_chunk(
4242
return Ok(false);
4343
}
4444

45-
let res = hex::encode(hasher.compute().0);
45+
let res = hex::encode(hasher.finalize().0);
4646
if res != ctx.checksum {
4747
return Ok(false);
4848
}

games/src/library.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
use std::fs::remove_dir_all;
2-
use std::sync::Mutex;
32
use std::thread::spawn;
43
use bitcode::{Decode, Encode};
54
use database::{borrow_db_checked, borrow_db_mut_checked, ApplicationTransientStatus, Database, DownloadableMetadata, GameDownloadStatus, GameVersion};
65
use log::{debug, error, warn};
76
use remote::{auth::generate_authorization_header, error::RemoteAccessError, requests::generate_url, utils::DROP_CLIENT_SYNC};
87
use serde::{Deserialize, Serialize};
9-
use tauri::{AppHandle, Emitter};
8+
use tauri::AppHandle;
109
use utils::app_emit;
1110

12-
use crate::{downloads::error::LibraryError, state::{GameStatusManager, GameStatusWithTransient}};
11+
use crate::{state::{GameStatusManager, GameStatusWithTransient}};
1312

1413
#[derive(Serialize, Deserialize, Debug)]
1514
pub struct FetchGameStruct {

process/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
use std::{
55
ops::Deref,
6-
sync::{LazyLock, OnceLock, nonpoison::Mutex},
6+
sync::{OnceLock, nonpoison::Mutex},
77
};
88

99
use tauri::AppHandle;

process/src/process_manager.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ use dynfmt::Format;
1818
use dynfmt::SimpleCurlyFormat;
1919
use games::{library::push_game_update, state::GameStatusManager};
2020
use log::{debug, info, warn};
21-
use serde::{Deserialize, Serialize};
2221
use shared_child::SharedChild;
2322
use tauri::AppHandle;
2423

src-tauri/src/client.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,11 @@ use download_manager::DOWNLOAD_MANAGER;
55
use log::{debug, error};
66
use tauri::AppHandle;
77
use tauri_plugin_autostart::ManagerExt;
8-
use utils::lock;
98

10-
use crate::{AppState};
9+
use crate::AppState;
1110

1211
#[tauri::command]
13-
pub fn fetch_state(
14-
state: tauri::State<'_, Mutex<AppState>>,
15-
) -> Result<String, String> {
12+
pub fn fetch_state(state: tauri::State<'_, Mutex<AppState>>) -> Result<String, String> {
1613
let guard = state.lock();
1714
let cloned_state = serde_json::to_string(&guard.clone()).map_err(|e| e.to_string())?;
1815
drop(guard);

0 commit comments

Comments
 (0)