Skip to content

Commit f19bf2e

Browse files
guylamar2006Guy Chronister
and
Guy Chronister
authored
Fix clippy warnings and typos (#434)
* Fix clippy warnings. * Fixe more clippy warnings. * Fix exided lifetime warnings in clippy. * Fix errors. * Fix errors. --------- Co-authored-by: Guy Chronister <[email protected]>
1 parent 6bc3908 commit f19bf2e

18 files changed

+55
-64
lines changed

.github/workflows/main.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
test_Ubuntu:
1515
runs-on: ubuntu-latest
1616
steps:
17-
- uses: actions/checkout@v3
17+
- uses: actions/checkout@v4
1818
- name: Rust Cache
1919
uses: Swatinem/rust-cache@v2
2020
- name: dependencies
@@ -28,7 +28,7 @@ jobs:
2828
test_Windows:
2929
runs-on: windows-latest
3030
steps:
31-
- uses: actions/checkout@v3
31+
- uses: actions/checkout@v4
3232
- name: Install latest stable
3333
uses: actions-rs/toolchain@v1
3434
with:
@@ -41,7 +41,7 @@ jobs:
4141
# test_Macos:
4242
# runs-on: macos-latest
4343
# steps:
44-
# - uses: actions/checkout@v3
44+
# - uses: actions/checkout@v4
4545
# - name: Install latest stable
4646
# uses: actions-rs/toolchain@v1
4747
# with:

.github/workflows/release_on_v_tag.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
asset_name: windows_BoilR.exe
3939
strip: false
4040
steps:
41-
- uses: actions/checkout@v3
41+
- uses: actions/checkout@v4
4242
- name: Install dependencies
4343
if: ${{ matrix.os == 'ubuntu-latest'}}
4444
run: |

.github/workflows/rust-clippy.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
2929
steps:
3030
- name: Checkout code
31-
uses: actions/checkout@v2
31+
uses: actions/checkout@v4
3232

3333
- name: Install Rust toolchain
3434
uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af #@v1
@@ -49,7 +49,7 @@ jobs:
4949
continue-on-error: true
5050

5151
- name: Upload analysis results to GitHub
52-
uses: github/codeql-action/upload-sarif@v1
52+
uses: github/codeql-action/upload-sarif@v2
5353
with:
5454
sarif_file: rust-clippy-results.sarif
5555
wait-for-processing: true

src/platforms/egs/epic_ui.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ impl EpicPlatform {
1313
};
1414

1515
egui::CollapsingHeader::new(safe_mode_header)
16-
.id_source("Epic_Launcher_safe_launch")
16+
.id_salt("Epic_Launcher_safe_launch")
1717
.show(ui, |ui| {
1818
ui.label("Some games must be started from the Epic Launcher, select those games below and BoilR will create shortcuts that opens the games through the Epic Launcher.");
1919
let manifests =self.epic_manifests.get_or_insert_with(||{

src/platforms/heroic/heroic_platform.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ impl GamesPlatform for HeroicPlatform {
244244
(true, x) => format!("{x} games forced to launch directly"),
245245
};
246246

247-
egui::CollapsingHeader::new(safe_mode_header).id_source("Heroic_Launcher_safe_launch").show(ui, |ui| {
247+
egui::CollapsingHeader::new(safe_mode_header).id_salt("Heroic_Launcher_safe_launch").show(ui, |ui| {
248248
if self.settings.default_launch_through_heroic{
249249
ui.label("Some games work best when launched directly, select those games below and BoilR will create shortcuts that launch the games directly.");
250250
} else {

src/platforms/itch/butler_db_parser.rs

+7-9
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,13 @@ fn parse_path(i: &[u8]) -> nom::IResult<&[u8], DbPaths> {
3838

3939
let candidates = serde_json::from_str::<Vec<Candidate>>(&candidates_json);
4040
match candidates {
41-
Ok(candidates) => {
42-
return IResult::Ok((
43-
i,
44-
DbPaths {
45-
base_path,
46-
paths: candidates.iter().map(|c| c.path.clone()).collect(),
47-
},
48-
))
49-
}
41+
Ok(candidates) => IResult::Ok((
42+
i,
43+
DbPaths {
44+
base_path,
45+
paths: candidates.iter().map(|c| c.path.clone()).collect(),
46+
},
47+
)),
5048
Err(_err) => {
5149
//we found a basepath, but no executables
5250
IResult::Ok((

src/platforms/lutris/game_list_parser.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
use super::lutris_game::LutrisGame;
22

33
pub fn parse_lutris_games(input: &str) -> Vec<LutrisGame> {
4-
let games = serde_json::from_str::<Vec<LutrisGame>>(input);
5-
match games {
6-
Ok(games) => games,
7-
Err(_err) => Vec::new(),
8-
}
4+
serde_json::from_str::<Vec<LutrisGame>>(input).unwrap_or_default()
95
}
106

117
#[cfg(test)]

src/platforms/uplay/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,3 @@ mod platform;
33
mod settings;
44

55
pub use platform::UplayPlatform;
6-
pub use settings::UplaySettings;

src/steam/utils.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,11 @@ pub fn get_shortcuts_paths(settings: &SteamSettings) -> eyre::Result<Vec<SteamUs
9090
let shortcuts_path = Path::new(path.as_str());
9191
let folder_string = folder_str.to_string();
9292
if shortcuts_path.exists() {
93-
return SteamUsersInfo {
93+
SteamUsersInfo {
9494
steam_user_data_folder: folder_string,
9595
shortcut_path: Some(shortcuts_path.to_string_lossy().to_string()),
9696
user_id,
97-
};
97+
}
9898
} else {
9999
SteamUsersInfo {
100100
steam_user_data_folder: folder_string,

src/steamgriddb/cached_search.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ pub struct CachedSearch<'a> {
1111
}
1212

1313
impl<'a> CachedSearch<'a> {
14-
pub fn new(client: &steamgriddb_api::Client) -> CachedSearch {
14+
pub fn new(client: &'a steamgriddb_api::Client) -> CachedSearch<'a> {
1515
CachedSearch {
1616
search_map: get_search_map(),
1717
client,

src/steamgriddb/downloader.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ impl SearchSettings for Settings {
4545
}
4646
}
4747

48-
pub async fn download_images_for_users<'b>(
48+
pub async fn download_images_for_users(
4949
settings: &Settings,
5050
users: &[SteamUsersInfo],
5151
sender: &mut Option<Sender<SyncProgress>>,
@@ -388,10 +388,10 @@ async fn get_steam_image_url(game_id: usize, image_type: &ImageType) -> Option<S
388388
d.platforms
389389
.map(|p| p.steam.map(|s| s.metadata.map(|m| m.store_asset_mtime)))
390390
});
391-
if let (Some(Some(Some(steam_app_id))), Some(Some(Some(Some(Some(mtime)))))) =
391+
if let (Some(Some(Some(steam_app_id))), Some(Some(Some(Some(mtime))))) =
392392
(game_id, mtime)
393393
{
394-
return Some(image_type.steam_url(steam_app_id, mtime));
394+
return Some(image_type.steam_url(steam_app_id.to_string(), mtime?));
395395
}
396396
}
397397
}
@@ -412,10 +412,10 @@ async fn get_steam_icon_url(game_id: usize) -> Option<String> {
412412
d.platforms
413413
.map(|p| p.steam.map(|s| s.metadata.map(|m| m.clienticon)))
414414
});
415-
if let (Some(Some(Some(steam_app_id))), Some(Some(Some(Some(Some(mtime)))))) =
415+
if let (Some(Some(Some(steam_app_id))), Some(Some(Some(Some(mtime))))) =
416416
(game_id, mtime)
417417
{
418-
return Some(icon_url(&steam_app_id, &mtime));
418+
return Some(icon_url(&steam_app_id.to_string(), &mtime?.to_string()));
419419
}
420420
}
421421
}

src/ui/components/steam_user_select.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ pub fn render_user_select<'a>(
2626
None
2727
}
2828
} else {
29-
return steam_users.first();
29+
steam_users.first()
3030
}
3131
}

src/ui/images/image_select_state.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
21
use steam_shortcuts_util::shortcut::ShortcutOwned;
32

4-
use crate::{steam::SteamUsersInfo, steamgriddb::ImageType, ui::FetcStatus};
3+
use crate::{steam::SteamUsersInfo, steamgriddb::ImageType, ui::FetchStatus};
54

65
use super::{ gamemode::GameMode, possible_image::PossibleImage, gametype::GameType};
76

@@ -18,7 +17,7 @@ pub struct ImageSelectState {
1817
pub user_shortcuts: Option<Vec<ShortcutOwned>>,
1918
pub game_mode: GameMode,
2019
pub image_type_selected: Option<ImageType>,
21-
pub image_options: Receiver<FetcStatus<Vec<PossibleImage>>>,
20+
pub image_options: Receiver<FetchStatus<Vec<PossibleImage>>>,
2221
pub steam_games: Option<Vec<crate::steam::SteamGameInfo>>,
2322

2423
pub possible_names: Option<Vec<steamgriddb_api::search::SearchResult>>,
@@ -38,9 +37,8 @@ impl Default for ImageSelectState {
3837
game_mode: GameMode::Shortcuts,
3938
image_type_selected: Default::default(),
4039
possible_names: None,
41-
image_options: watch::channel(FetcStatus::NeedsFetched).1,
40+
image_options: watch::channel(FetchStatus::NeedsFetched).1,
4241
steam_games: None,
4342
}
4443
}
4544
}
46-

src/ui/images/pages/pick_new_image.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use crate::{
1111
constants::MAX_WIDTH, hasimagekey::HasImageKey, image_select_state::ImageSelectState,
1212
possible_image::PossibleImage, useraction::UserAction,
1313
},
14-
FetcStatus, MyEguiApp,
14+
FetchStatus, MyEguiApp,
1515
},
1616
};
1717

@@ -51,7 +51,7 @@ pub fn render_page_pick_image(
5151
let columns = (width / (column_width + column_padding)).floor() as u32;
5252
let mut column = 0;
5353
match &*state.image_options.borrow() {
54-
FetcStatus::Fetched(images) => {
54+
FetchStatus::Fetched(images) => {
5555
let x = Grid::new("ImageThumbnailSelectGrid")
5656
.spacing([column_padding, column_padding])
5757
.show(ui, |ui| {
@@ -128,7 +128,7 @@ pub fn handle_image_selected(app: &mut MyEguiApp, image: PossibleImage) {
128128

129129
{
130130
app.image_selected_state.image_type_selected = None;
131-
app.image_selected_state.image_options = watch::channel(FetcStatus::NeedsFetched).1;
131+
app.image_selected_state.image_options = watch::channel(FetchStatus::NeedsFetched).1;
132132
}
133133
}
134134
}

src/ui/images/ui_image_download.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use crate::{
1919
steam::{get_installed_games, SteamUsersInfo},
2020
steamgriddb::{get_image_extension, get_query_type, ImageType},
2121
sync::{download_images, SyncProgress},
22-
ui::{components::render_user_select, FetcStatus, MyEguiApp},
22+
ui::{components::render_user_select, FetchStatus, MyEguiApp},
2323
};
2424
use egui::ScrollArea;
2525
use futures::executor::block_on;
@@ -274,7 +274,7 @@ impl MyEguiApp {
274274
fn handle_image_type_selected(&mut self, image_type: ImageType) {
275275
let state = &mut self.image_selected_state;
276276
state.image_type_selected = Some(image_type);
277-
let (tx, rx) = watch::channel(FetcStatus::Fetching);
277+
let (tx, rx) = watch::channel(FetchStatus::Fetching);
278278
self.image_selected_state.image_options = rx;
279279
let settings = self.settings.clone();
280280
if let Some(auth_key) = settings.steamgrid_db.auth_key {
@@ -298,7 +298,7 @@ impl MyEguiApp {
298298
full_url: possible_image.url.clone(),
299299
});
300300
}
301-
let _ = tx.send(FetcStatus::Fetched(result));
301+
let _ = tx.send(FetchStatus::Fetched(result));
302302
}
303303
});
304304
}

src/ui/ui_disconnect.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ use crate::sync::disconnect_shortcut;
99
use crate::sync::IsBoilRShortcut;
1010

1111
#[derive(Default)]
12-
pub struct DiconnectState {
12+
pub struct DisconnectState {
1313
pub connected_shortcuts: Option<Result<Vec<ShortcutInfo>, String>>,
1414
}
1515

1616
impl MyEguiApp {
1717
pub fn render_disconnect(&mut self, ui: &mut egui::Ui) {
1818
let steam_settings = self.settings.steam.clone();
1919
let users_info = self
20-
.disconect_state
20+
.disconnect_state
2121
.connected_shortcuts
2222
.get_or_insert_with(|| {
2323
let users = get_shortcuts_paths(&steam_settings)
@@ -56,7 +56,7 @@ impl MyEguiApp {
5656

5757
for user in users.iter_mut() {
5858
if has_multiple_users {
59-
ui.heading(&user.path.to_string_lossy().to_string());
59+
ui.heading(user.path.to_string_lossy().to_string());
6060
}
6161
for shortcut in user.shortcuts.iter() {
6262
if shortcut.is_boilr_shortcut()
@@ -69,7 +69,7 @@ impl MyEguiApp {
6969
}
7070
});
7171
if redraw != 0 {
72-
self.disconect_state.connected_shortcuts = None;
72+
self.disconnect_state.connected_shortcuts = None;
7373
self.settings.blacklisted_games.push(redraw);
7474
}
7575
}

src/ui/ui_import_games.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,18 @@ use super::{
2222

2323
const SECTION_SPACING: f32 = 25.0;
2424

25-
pub enum FetcStatus<T> {
25+
pub enum FetchStatus<T> {
2626
NeedsFetched,
2727
Fetching,
2828
Fetched(T),
2929
}
3030

31-
impl<T> FetcStatus<T> {
31+
impl<T> FetchStatus<T> {
3232
pub fn is_some(&self) -> bool {
3333
match self {
34-
FetcStatus::NeedsFetched => false,
35-
FetcStatus::Fetching => false,
36-
FetcStatus::Fetched(_) => true,
34+
FetchStatus::NeedsFetched => false,
35+
FetchStatus::Fetching => false,
36+
FetchStatus::Fetched(_) => true,
3737
}
3838
}
3939
}
@@ -58,14 +58,14 @@ impl MyEguiApp {
5858
for (name,status) in &self.games_to_sync{
5959
ui.heading(name);
6060
match &*status.borrow(){
61-
FetcStatus::NeedsFetched => {ui.label("Need to find games");},
62-
FetcStatus::Fetching => {
61+
FetchStatus::NeedsFetched => {ui.label("Need to find games");},
62+
FetchStatus::Fetching => {
6363
ui.horizontal(|ui|{
6464
ui.spinner();
6565
ui.label("Finding installed games");
6666
});
6767
},
68-
FetcStatus::Fetched(shortcuts) => {
68+
FetchStatus::Fetched(shortcuts) => {
6969
match shortcuts{
7070
Ok(shortcuts) => {
7171
if shortcuts.is_empty(){

0 commit comments

Comments
 (0)