From 0513937dced819beb70f0e290bcbef71e54e15fd Mon Sep 17 00:00:00 2001 From: Guy Chronister Date: Wed, 8 Jan 2025 09:12:53 -0600 Subject: [PATCH 1/5] Fix clippy warnings. --- src/platforms/egs/epic_ui.rs | 2 +- src/platforms/heroic/heroic_platform.rs | 2 +- src/ui/images/image_select_state.rs | 8 +++----- src/ui/images/pages/pick_new_image.rs | 6 +++--- src/ui/images/ui_image_download.rs | 6 +++--- src/ui/ui_disconnect.rs | 8 ++++---- src/ui/ui_import_games.rs | 16 ++++++++-------- src/ui/uiapp.rs | 18 +++++++++--------- 8 files changed, 32 insertions(+), 34 deletions(-) diff --git a/src/platforms/egs/epic_ui.rs b/src/platforms/egs/epic_ui.rs index 4cb6ff9d..ab7ece64 100644 --- a/src/platforms/egs/epic_ui.rs +++ b/src/platforms/egs/epic_ui.rs @@ -13,7 +13,7 @@ impl EpicPlatform { }; egui::CollapsingHeader::new(safe_mode_header) - .id_source("Epic_Launcher_safe_launch") + .id_salt("Epic_Launcher_safe_launch") .show(ui, |ui| { 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."); let manifests =self.epic_manifests.get_or_insert_with(||{ diff --git a/src/platforms/heroic/heroic_platform.rs b/src/platforms/heroic/heroic_platform.rs index c64155c0..8030dda9 100644 --- a/src/platforms/heroic/heroic_platform.rs +++ b/src/platforms/heroic/heroic_platform.rs @@ -244,7 +244,7 @@ impl GamesPlatform for HeroicPlatform { (true, x) => format!("{x} games forced to launch directly"), }; - egui::CollapsingHeader::new(safe_mode_header).id_source("Heroic_Launcher_safe_launch").show(ui, |ui| { + egui::CollapsingHeader::new(safe_mode_header).id_salt("Heroic_Launcher_safe_launch").show(ui, |ui| { if self.settings.default_launch_through_heroic{ ui.label("Some games work best when launched directly, select those games below and BoilR will create shortcuts that launch the games directly."); } else { diff --git a/src/ui/images/image_select_state.rs b/src/ui/images/image_select_state.rs index ba62c611..aedbb3f8 100644 --- a/src/ui/images/image_select_state.rs +++ b/src/ui/images/image_select_state.rs @@ -1,7 +1,6 @@ - use steam_shortcuts_util::shortcut::ShortcutOwned; -use crate::{steam::SteamUsersInfo, steamgriddb::ImageType, ui::FetcStatus}; +use crate::{steam::SteamUsersInfo, steamgriddb::ImageType, ui::FetchStatus}; use super::{ gamemode::GameMode, possible_image::PossibleImage, gametype::GameType}; @@ -18,7 +17,7 @@ pub struct ImageSelectState { pub user_shortcuts: Option>, pub game_mode: GameMode, pub image_type_selected: Option, - pub image_options: Receiver>>, + pub image_options: Receiver>>, pub steam_games: Option>, pub possible_names: Option>, @@ -38,9 +37,8 @@ impl Default for ImageSelectState { game_mode: GameMode::Shortcuts, image_type_selected: Default::default(), possible_names: None, - image_options: watch::channel(FetcStatus::NeedsFetched).1, + image_options: watch::channel(FetchStatus::NeedsFetched).1, steam_games: None, } } } - diff --git a/src/ui/images/pages/pick_new_image.rs b/src/ui/images/pages/pick_new_image.rs index 9d27d536..d2e4aea0 100644 --- a/src/ui/images/pages/pick_new_image.rs +++ b/src/ui/images/pages/pick_new_image.rs @@ -11,7 +11,7 @@ use crate::{ constants::MAX_WIDTH, hasimagekey::HasImageKey, image_select_state::ImageSelectState, possible_image::PossibleImage, useraction::UserAction, }, - FetcStatus, MyEguiApp, + FetchStatus, MyEguiApp, }, }; @@ -51,7 +51,7 @@ pub fn render_page_pick_image( let columns = (width / (column_width + column_padding)).floor() as u32; let mut column = 0; match &*state.image_options.borrow() { - FetcStatus::Fetched(images) => { + FetchStatus::Fetched(images) => { let x = Grid::new("ImageThumbnailSelectGrid") .spacing([column_padding, column_padding]) .show(ui, |ui| { @@ -128,7 +128,7 @@ pub fn handle_image_selected(app: &mut MyEguiApp, image: PossibleImage) { { app.image_selected_state.image_type_selected = None; - app.image_selected_state.image_options = watch::channel(FetcStatus::NeedsFetched).1; + app.image_selected_state.image_options = watch::channel(FetchStatus::NeedsFetched).1; } } } diff --git a/src/ui/images/ui_image_download.rs b/src/ui/images/ui_image_download.rs index 23219b87..5ab94e73 100644 --- a/src/ui/images/ui_image_download.rs +++ b/src/ui/images/ui_image_download.rs @@ -19,7 +19,7 @@ use crate::{ steam::{get_installed_games, SteamUsersInfo}, steamgriddb::{get_image_extension, get_query_type, ImageType}, sync::{download_images, SyncProgress}, - ui::{components::render_user_select, FetcStatus, MyEguiApp}, + ui::{components::render_user_select, FetchStatus, MyEguiApp}, }; use egui::ScrollArea; use futures::executor::block_on; @@ -274,7 +274,7 @@ impl MyEguiApp { fn handle_image_type_selected(&mut self, image_type: ImageType) { let state = &mut self.image_selected_state; state.image_type_selected = Some(image_type); - let (tx, rx) = watch::channel(FetcStatus::Fetching); + let (tx, rx) = watch::channel(FetchStatus::Fetching); self.image_selected_state.image_options = rx; let settings = self.settings.clone(); if let Some(auth_key) = settings.steamgrid_db.auth_key { @@ -298,7 +298,7 @@ impl MyEguiApp { full_url: possible_image.url.clone(), }); } - let _ = tx.send(FetcStatus::Fetched(result)); + let _ = tx.send(FetchStatus::Fetched(result)); } }); } diff --git a/src/ui/ui_disconnect.rs b/src/ui/ui_disconnect.rs index 98648d73..098107f9 100644 --- a/src/ui/ui_disconnect.rs +++ b/src/ui/ui_disconnect.rs @@ -9,7 +9,7 @@ use crate::sync::disconnect_shortcut; use crate::sync::IsBoilRShortcut; #[derive(Default)] -pub struct DiconnectState { +pub struct DisconnectState { pub connected_shortcuts: Option, String>>, } @@ -17,7 +17,7 @@ impl MyEguiApp { pub fn render_disconnect(&mut self, ui: &mut egui::Ui) { let steam_settings = self.settings.steam.clone(); let users_info = self - .disconect_state + .disconnect_state .connected_shortcuts .get_or_insert_with(|| { let users = get_shortcuts_paths(&steam_settings) @@ -56,7 +56,7 @@ impl MyEguiApp { for user in users.iter_mut() { if has_multiple_users { - ui.heading(&user.path.to_string_lossy().to_string()); + ui.heading(user.path.to_string_lossy().to_string()); } for shortcut in user.shortcuts.iter() { if shortcut.is_boilr_shortcut() @@ -69,7 +69,7 @@ impl MyEguiApp { } }); if redraw != 0 { - self.disconect_state.connected_shortcuts = None; + self.disconnect_state.connected_shortcuts = None; self.settings.blacklisted_games.push(redraw); } } diff --git a/src/ui/ui_import_games.rs b/src/ui/ui_import_games.rs index c5fa8892..a29c057c 100644 --- a/src/ui/ui_import_games.rs +++ b/src/ui/ui_import_games.rs @@ -22,18 +22,18 @@ use super::{ const SECTION_SPACING: f32 = 25.0; -pub enum FetcStatus { +pub enum FetchStatus { NeedsFetched, Fetching, Fetched(T), } -impl FetcStatus { +impl FetchStatus { pub fn is_some(&self) -> bool { match self { - FetcStatus::NeedsFetched => false, - FetcStatus::Fetching => false, - FetcStatus::Fetched(_) => true, + FetchStatus::NeedsFetched => false, + FetchStatus::Fetching => false, + FetchStatus::Fetched(_) => true, } } } @@ -58,14 +58,14 @@ impl MyEguiApp { for (name,status) in &self.games_to_sync{ ui.heading(name); match &*status.borrow(){ - FetcStatus::NeedsFetched => {ui.label("Need to find games");}, - FetcStatus::Fetching => { + FetchStatus::NeedsFetched => {ui.label("Need to find games");}, + FetchStatus::Fetching => { ui.horizontal(|ui|{ ui.spinner(); ui.label("Finding installed games"); }); }, - FetcStatus::Fetched(shortcuts) => { + FetchStatus::Fetched(shortcuts) => { match shortcuts{ Ok(shortcuts) => { if shortcuts.is_empty(){ diff --git a/src/ui/uiapp.rs b/src/ui/uiapp.rs index 5f777ca9..546df75d 100644 --- a/src/ui/uiapp.rs +++ b/src/ui/uiapp.rs @@ -23,8 +23,8 @@ use super::{ TEXT_COLOR, }, ui_images::get_logo_icon, - ui_import_games::FetcStatus, - BackupState, DiconnectState, + ui_import_games::FetchStatus, + BackupState, DisconnectState, }; const SECTION_SPACING: f32 = 25.0; @@ -32,7 +32,7 @@ const SECTION_SPACING: f32 = 25.0; type GamesToSync = Vec<( String, - Receiver>>>, + Receiver>>>, )>; pub(crate) fn all_ready(games: &GamesToSync) -> bool { @@ -43,7 +43,7 @@ pub(crate) fn get_all_games(games: &GamesToSync) -> Vec<(String, Vec, pub(crate) image_selected_state: ImageSelectState, pub(crate) backup_state: BackupState, - pub(crate) disconect_state: DiconnectState, + pub(crate) disconnect_state: DisconnectState, pub(crate) rename_map: HashMap, pub(crate) current_edit: Option, pub(crate) platforms: Platforms, @@ -80,7 +80,7 @@ impl MyEguiApp { status_reciever: watch::channel(SyncProgress::NotStarted).1, image_selected_state: ImageSelectState::default(), backup_state: BackupState::default(), - disconect_state: DiconnectState::default(), + disconnect_state: DisconnectState::default(), rename_map: get_rename_map(), current_edit: Option::None, platforms, @@ -160,13 +160,13 @@ fn create_games_to_sync(rt: &mut Runtime, platforms: &[Box]) let mut to_sync = vec![]; for platform in platforms { if platform.enabled() { - let (tx, rx) = watch::channel(FetcStatus::NeedsFetched); + let (tx, rx) = watch::channel(FetchStatus::NeedsFetched); to_sync.push((platform.name().to_string(), rx)); let platform = platform.clone(); rt.spawn_blocking(move || { - let _ = tx.send(FetcStatus::Fetching); + let _ = tx.send(FetchStatus::Fetching); let games_to_sync = sync::get_platform_shortcuts(platform); - let _ = tx.send(FetcStatus::Fetched(games_to_sync)); + let _ = tx.send(FetchStatus::Fetched(games_to_sync)); }); } } From 574c07d707efc2f7867b46931c679c8dba8eb49a Mon Sep 17 00:00:00 2001 From: Guy Chronister Date: Sun, 12 Jan 2025 10:20:44 -0600 Subject: [PATCH 2/5] Fixe more clippy warnings. --- .github/workflows/main.yml | 6 +++--- .github/workflows/release_on_v_tag.yml | 2 +- .github/workflows/rust-clippy.yml | 4 ++-- src/platforms/itch/butler_db_parser.rs | 16 +++++++--------- src/platforms/lutris/game_list_parser.rs | 6 +----- src/steam/utils.rs | 4 ++-- src/ui/components/steam_user_select.rs | 2 +- 7 files changed, 17 insertions(+), 23 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2859011d..b4d48e99 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -14,7 +14,7 @@ jobs: test_Ubuntu: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Rust Cache uses: Swatinem/rust-cache@v2 - name: dependencies @@ -28,7 +28,7 @@ jobs: test_Windows: runs-on: windows-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install latest stable uses: actions-rs/toolchain@v1 with: @@ -41,7 +41,7 @@ jobs: # test_Macos: # runs-on: macos-latest # steps: - # - uses: actions/checkout@v3 + # - uses: actions/checkout@v4 # - name: Install latest stable # uses: actions-rs/toolchain@v1 # with: diff --git a/.github/workflows/release_on_v_tag.yml b/.github/workflows/release_on_v_tag.yml index ddc24ec8..40bda705 100644 --- a/.github/workflows/release_on_v_tag.yml +++ b/.github/workflows/release_on_v_tag.yml @@ -38,7 +38,7 @@ jobs: asset_name: windows_BoilR.exe strip: false steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install dependencies if: ${{ matrix.os == 'ubuntu-latest'}} run: | diff --git a/.github/workflows/rust-clippy.yml b/.github/workflows/rust-clippy.yml index 340b35b0..7713a604 100644 --- a/.github/workflows/rust-clippy.yml +++ b/.github/workflows/rust-clippy.yml @@ -28,7 +28,7 @@ jobs: actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Install Rust toolchain uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af #@v1 @@ -49,7 +49,7 @@ jobs: continue-on-error: true - name: Upload analysis results to GitHub - uses: github/codeql-action/upload-sarif@v1 + uses: github/codeql-action/upload-sarif@v2 with: sarif_file: rust-clippy-results.sarif wait-for-processing: true diff --git a/src/platforms/itch/butler_db_parser.rs b/src/platforms/itch/butler_db_parser.rs index 9f0ac242..2c6d9163 100644 --- a/src/platforms/itch/butler_db_parser.rs +++ b/src/platforms/itch/butler_db_parser.rs @@ -38,15 +38,13 @@ fn parse_path(i: &[u8]) -> nom::IResult<&[u8], DbPaths> { let candidates = serde_json::from_str::>(&candidates_json); match candidates { - Ok(candidates) => { - return IResult::Ok(( - i, - DbPaths { - base_path, - paths: candidates.iter().map(|c| c.path.clone()).collect(), - }, - )) - } + Ok(candidates) => IResult::Ok(( + i, + DbPaths { + base_path, + paths: candidates.iter().map(|c| c.path.clone()).collect(), + }, + )), Err(_err) => { //we found a basepath, but no executables IResult::Ok(( diff --git a/src/platforms/lutris/game_list_parser.rs b/src/platforms/lutris/game_list_parser.rs index b1a66d4a..fde926ab 100644 --- a/src/platforms/lutris/game_list_parser.rs +++ b/src/platforms/lutris/game_list_parser.rs @@ -1,11 +1,7 @@ use super::lutris_game::LutrisGame; pub fn parse_lutris_games(input: &str) -> Vec { - let games = serde_json::from_str::>(input); - match games { - Ok(games) => games, - Err(_err) => Vec::new(), - } + serde_json::from_str::>(input).unwrap_or_default() } #[cfg(test)] diff --git a/src/steam/utils.rs b/src/steam/utils.rs index d7d3f3fb..92525e5b 100644 --- a/src/steam/utils.rs +++ b/src/steam/utils.rs @@ -90,11 +90,11 @@ pub fn get_shortcuts_paths(settings: &SteamSettings) -> eyre::Result( None } } else { - return steam_users.first(); + steam_users.first() } } From d057a7b488ddbac77553a1951c27ba08c1a4c531 Mon Sep 17 00:00:00 2001 From: Guy Chronister Date: Sun, 12 Jan 2025 10:43:40 -0600 Subject: [PATCH 3/5] Fix exided lifetime warnings in clippy. --- src/steamgriddb/cached_search.rs | 6 +++--- src/steamgriddb/downloader.rs | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/steamgriddb/cached_search.rs b/src/steamgriddb/cached_search.rs index bfdd4841..af33d006 100644 --- a/src/steamgriddb/cached_search.rs +++ b/src/steamgriddb/cached_search.rs @@ -5,12 +5,12 @@ use crate::config::get_cache_file; type SearchMap = DashMap; -pub struct CachedSearch<'a> { +pub struct CachedSearch<'_> { search_map: SearchMap, - client: &'a steamgriddb_api::Client, + client: &'_ steamgriddb_api::Client, } -impl<'a> CachedSearch<'a> { +impl CachedSearch<'_> { pub fn new(client: &steamgriddb_api::Client) -> CachedSearch { CachedSearch { search_map: get_search_map(), diff --git a/src/steamgriddb/downloader.rs b/src/steamgriddb/downloader.rs index ac981881..5b80762f 100644 --- a/src/steamgriddb/downloader.rs +++ b/src/steamgriddb/downloader.rs @@ -45,7 +45,7 @@ impl SearchSettings for Settings { } } -pub async fn download_images_for_users<'b>( +pub async fn download_images_for_users( settings: &Settings, users: &[SteamUsersInfo], sender: &mut Option>, @@ -388,7 +388,7 @@ async fn get_steam_image_url(game_id: usize, image_type: &ImageType) -> Option Option { d.platforms .map(|p| p.steam.map(|s| s.metadata.map(|m| m.clienticon))) }); - if let (Some(Some(Some(steam_app_id))), Some(Some(Some(Some(Some(mtime)))))) = + if let (Some(Some(Some(steam_app_id))), Some(Some(Some(Some(mtime))))) = (game_id, mtime) { return Some(icon_url(&steam_app_id, &mtime)); From db6e9d5696aedcc619d6fc3cd466f0fc74b0ddd6 Mon Sep 17 00:00:00 2001 From: Guy Chronister Date: Sun, 12 Jan 2025 10:51:20 -0600 Subject: [PATCH 4/5] Fix errors. --- src/steamgriddb/cached_search.rs | 8 ++++---- src/steamgriddb/downloader.rs | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/steamgriddb/cached_search.rs b/src/steamgriddb/cached_search.rs index af33d006..959b9c54 100644 --- a/src/steamgriddb/cached_search.rs +++ b/src/steamgriddb/cached_search.rs @@ -5,13 +5,13 @@ use crate::config::get_cache_file; type SearchMap = DashMap; -pub struct CachedSearch<'_> { +pub struct CachedSearch<'a> { search_map: SearchMap, - client: &'_ steamgriddb_api::Client, + client: &'a steamgriddb_api::Client, } -impl CachedSearch<'_> { - pub fn new(client: &steamgriddb_api::Client) -> CachedSearch { +impl<'a> CachedSearch<'a> { + pub fn new(client: &'a steamgriddb_api::Client) -> CachedSearch<'a> { CachedSearch { search_map: get_search_map(), client, diff --git a/src/steamgriddb/downloader.rs b/src/steamgriddb/downloader.rs index 5b80762f..b793a7d1 100644 --- a/src/steamgriddb/downloader.rs +++ b/src/steamgriddb/downloader.rs @@ -391,7 +391,7 @@ async fn get_steam_image_url(game_id: usize, image_type: &ImageType) -> Option Option { if let (Some(Some(Some(steam_app_id))), Some(Some(Some(Some(mtime))))) = (game_id, mtime) { - return Some(icon_url(&steam_app_id, &mtime)); + return Some(icon_url(&steam_app_id.to_string(), &mtime.to_string())); } } } From d03705571c8c7a2aa7ebb53eee3b1220afc74a90 Mon Sep 17 00:00:00 2001 From: Guy Chronister Date: Sun, 12 Jan 2025 10:55:45 -0600 Subject: [PATCH 5/5] Fix errors. --- src/platforms/uplay/mod.rs | 1 - src/steamgriddb/downloader.rs | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/platforms/uplay/mod.rs b/src/platforms/uplay/mod.rs index f8e7fe0e..332b9353 100644 --- a/src/platforms/uplay/mod.rs +++ b/src/platforms/uplay/mod.rs @@ -3,4 +3,3 @@ mod platform; mod settings; pub use platform::UplayPlatform; -pub use settings::UplaySettings; diff --git a/src/steamgriddb/downloader.rs b/src/steamgriddb/downloader.rs index b793a7d1..d3d22558 100644 --- a/src/steamgriddb/downloader.rs +++ b/src/steamgriddb/downloader.rs @@ -391,7 +391,7 @@ async fn get_steam_image_url(game_id: usize, image_type: &ImageType) -> Option Option { if let (Some(Some(Some(steam_app_id))), Some(Some(Some(Some(mtime))))) = (game_id, mtime) { - return Some(icon_url(&steam_app_id.to_string(), &mtime.to_string())); + return Some(icon_url(&steam_app_id.to_string(), &mtime?.to_string())); } } }