Skip to content
This repository was archived by the owner on Jul 24, 2026. It is now read-only.

Commit a188e27

Browse files
committed
fix: clippy
1 parent f90388a commit a188e27

5 files changed

Lines changed: 25 additions & 31 deletions

File tree

src-tauri/games/src/downloads/download_agent.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use std::collections::HashMap;
2525
use std::fmt::Debug;
2626
use std::fs::{create_dir_all, remove_file};
2727
use std::io;
28-
use std::path::{Path, PathBuf, StripPrefixError};
28+
use std::path::{Path, PathBuf};
2929
use std::sync::{Arc, Mutex};
3030
use std::time::Instant;
3131
use tauri::AppHandle;
@@ -308,7 +308,7 @@ impl GameDownloadAgent {
308308
let current_file_tree = self.scan_filetree(base_path)?;
309309

310310
for file in current_file_tree {
311-
let filename = file.strip_prefix(&base_path)?.to_string_lossy().to_string();
311+
let filename = file.strip_prefix(base_path)?.to_string_lossy().to_string();
312312
let needed = file_list.contains_key(&filename) || filename == ".dropdata";
313313
if !needed {
314314
info!("deleted {}", file.display());
@@ -330,7 +330,7 @@ impl GameDownloadAgent {
330330
}
331331
Ok(())
332332
}
333-
Err(err) => return Err(err),
333+
Err(err) => Err(err),
334334
};
335335

336336
let mut index = 0;

src-tauri/games/src/downloads/download_logic.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::fs::{Permissions, set_permissions};
33
use std::io::SeekFrom;
44
#[cfg(unix)]
55
use std::os::unix::fs::PermissionsExt;
6-
use std::path::{Path, PathBuf};
6+
use std::path::Path;
77
use std::sync::Arc;
88
use std::time::Instant;
99

@@ -95,7 +95,7 @@ pub async fn download_game_chunk(
9595

9696
let stream = response
9797
.bytes_stream()
98-
.map(|v| v.map_err(|err| std::io::Error::other(err)));
98+
.map(|v| v.map_err(std::io::Error::other));
9999
let mut stream_reader = StreamReader::new(stream);
100100
//let mut stream_reader = response;
101101

src-tauri/src/downloads.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ use download_manager::{
99
DOWNLOAD_MANAGER, downloadable::Downloadable, error::ApplicationDownloadError,
1010
};
1111
use games::downloads::download_agent::GameDownloadAgent;
12-
use log::info;
1312

1413
#[tauri::command]
1514
pub async fn download_game(
@@ -37,8 +36,10 @@ pub async fn download_game(
3736
}
3837
};
3938

40-
let mut configuration = UserConfiguration::default();
41-
configuration.enable_updates = enable_updates;
39+
let configuration = UserConfiguration {
40+
enable_updates,
41+
..Default::default()
42+
};
4243

4344
let base_dir = {
4445
let db_lock = borrow_db_checked();

src-tauri/src/scheduler.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
use std::{time::Duration, usize};
1+
use std::{time::Duration};
22

33
use async_trait::async_trait;
4-
use log::{info, warn};
4+
use log::warn;
55
use tokio::time;
66

77
use crate::updates::GameUpdater;

src-tauri/src/updates.rs

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ use std::sync::nonpoison::Mutex;
33
use async_trait::async_trait;
44
use client::{app_state::AppState, app_status::AppStatus};
55
use database::{
6-
DownloadableMetadata, GameDownloadStatus, GameVersion, borrow_db_checked, borrow_db_mut_checked,
6+
GameDownloadStatus, GameVersion, borrow_db_checked, borrow_db_mut_checked,
77
};
8-
use log::{info, warn};
8+
use log::warn;
99
use process::PROCESS_MANAGER;
1010
use remote::utils::DROP_APP_HANDLE;
1111
use tauri::Manager;
@@ -44,12 +44,9 @@ impl ScheduleTask for GameUpdater {
4444
let state = app_handle.state::<Mutex<AppState>>();
4545
{
4646
let state_lock = state.lock();
47-
match state_lock.status {
48-
AppStatus::Offline => {
49-
self.no_internet = true;
50-
return Ok(());
51-
}
52-
_ => {}
47+
if state_lock.status == AppStatus::Offline {
48+
self.no_internet = true;
49+
return Ok(());
5350
};
5451
};
5552

@@ -58,7 +55,9 @@ impl ScheduleTask for GameUpdater {
5855
let to_check: Vec<GameVersion> = {
5956
let db_lock = borrow_db_checked();
6057

61-
let games = db_lock
58+
59+
60+
db_lock
6261
.applications
6362
.game_statuses
6463
.values()
@@ -67,17 +66,14 @@ impl ScheduleTask for GameUpdater {
6766
_ => None,
6867
})
6968
.map(|v| {
70-
v.map(|version_id| db_lock.applications.game_versions.get(version_id))
71-
.flatten()
69+
v.and_then(|version_id| db_lock.applications.game_versions.get(version_id))
7270
})
7371
.filter(|v| {
7472
v.map(|v| v.user_configuration.enable_updates)
7573
.unwrap_or(false)
7674
})
7775
.map(|v| v.cloned().unwrap())
78-
.collect();
79-
80-
games
76+
.collect()
8177
};
8278

8379
for version in to_check {
@@ -99,7 +95,7 @@ impl ScheduleTask for GameUpdater {
9995
.filter(|v| process_manager_lock.valid_platform(&v.platform))
10096
.collect();
10197

102-
let latest = match valid_options.get(0) {
98+
let latest = match valid_options.first() {
10399
Some(v) => v,
104100
None => {
105101
warn!("found no versions for game id: {}", version.game_id);
@@ -113,13 +109,10 @@ impl ScheduleTask for GameUpdater {
113109
.get_mut(&version.game_id)
114110
.ok_or(anyhow::anyhow!(""))?;
115111

116-
match game_status {
117-
GameDownloadStatus::Installed {
112+
if let GameDownloadStatus::Installed {
118113
update_available, ..
119-
} => {
120-
*update_available = latest.version_id != version.version_id;
121-
}
122-
_ => (),
114+
} = game_status {
115+
*update_available = latest.version_id != version.version_id;
123116
};
124117
}
125118

0 commit comments

Comments
 (0)