Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix clippy warnings and typos #434

Merged
merged 5 commits into from
Jan 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand All @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release_on_v_tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/rust-clippy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
2 changes: 1 addition & 1 deletion src/platforms/egs/epic_ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(||{
Expand Down
2 changes: 1 addition & 1 deletion src/platforms/heroic/heroic_platform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
16 changes: 7 additions & 9 deletions src/platforms/itch/butler_db_parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,13 @@ fn parse_path(i: &[u8]) -> nom::IResult<&[u8], DbPaths> {

let candidates = serde_json::from_str::<Vec<Candidate>>(&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((
Expand Down
6 changes: 1 addition & 5 deletions src/platforms/lutris/game_list_parser.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
use super::lutris_game::LutrisGame;

pub fn parse_lutris_games(input: &str) -> Vec<LutrisGame> {
let games = serde_json::from_str::<Vec<LutrisGame>>(input);
match games {
Ok(games) => games,
Err(_err) => Vec::new(),
}
serde_json::from_str::<Vec<LutrisGame>>(input).unwrap_or_default()
}

#[cfg(test)]
Expand Down
1 change: 0 additions & 1 deletion src/platforms/uplay/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ mod platform;
mod settings;

pub use platform::UplayPlatform;
pub use settings::UplaySettings;
4 changes: 2 additions & 2 deletions src/steam/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,11 @@ pub fn get_shortcuts_paths(settings: &SteamSettings) -> eyre::Result<Vec<SteamUs
let shortcuts_path = Path::new(path.as_str());
let folder_string = folder_str.to_string();
if shortcuts_path.exists() {
return SteamUsersInfo {
SteamUsersInfo {
steam_user_data_folder: folder_string,
shortcut_path: Some(shortcuts_path.to_string_lossy().to_string()),
user_id,
};
}
} else {
SteamUsersInfo {
steam_user_data_folder: folder_string,
Expand Down
2 changes: 1 addition & 1 deletion src/steamgriddb/cached_search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pub struct CachedSearch<'a> {
}

impl<'a> CachedSearch<'a> {
pub fn new(client: &steamgriddb_api::Client) -> CachedSearch {
pub fn new(client: &'a steamgriddb_api::Client) -> CachedSearch<'a> {
CachedSearch {
search_map: get_search_map(),
client,
Expand Down
10 changes: 5 additions & 5 deletions src/steamgriddb/downloader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
}
}

pub async fn download_images_for_users<'b>(
pub async fn download_images_for_users(
settings: &Settings,
users: &[SteamUsersInfo],
sender: &mut Option<Sender<SyncProgress>>,
Expand Down Expand Up @@ -388,10 +388,10 @@
d.platforms
.map(|p| p.steam.map(|s| s.metadata.map(|m| m.store_asset_mtime)))
});
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(image_type.steam_url(steam_app_id, mtime));
return Some(image_type.steam_url(steam_app_id.to_string(), mtime?));
Dismissed Show dismissed Hide dismissed
}
}
}
Expand All @@ -412,10 +412,10 @@
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));
return Some(icon_url(&steam_app_id.to_string(), &mtime?.to_string()));
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/ui/components/steam_user_select.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ pub fn render_user_select<'a>(
None
}
} else {
return steam_users.first();
steam_users.first()
}
}
8 changes: 3 additions & 5 deletions src/ui/images/image_select_state.rs
Original file line number Diff line number Diff line change
@@ -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};

Expand All @@ -18,7 +17,7 @@ pub struct ImageSelectState {
pub user_shortcuts: Option<Vec<ShortcutOwned>>,
pub game_mode: GameMode,
pub image_type_selected: Option<ImageType>,
pub image_options: Receiver<FetcStatus<Vec<PossibleImage>>>,
pub image_options: Receiver<FetchStatus<Vec<PossibleImage>>>,
pub steam_games: Option<Vec<crate::steam::SteamGameInfo>>,

pub possible_names: Option<Vec<steamgriddb_api::search::SearchResult>>,
Expand All @@ -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,
}
}
}

6 changes: 3 additions & 3 deletions src/ui/images/pages/pick_new_image.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use crate::{
constants::MAX_WIDTH, hasimagekey::HasImageKey, image_select_state::ImageSelectState,
possible_image::PossibleImage, useraction::UserAction,
},
FetcStatus, MyEguiApp,
FetchStatus, MyEguiApp,
},
};

Expand Down Expand Up @@ -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| {
Expand Down Expand Up @@ -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;
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/ui/images/ui_image_download.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 {
Expand All @@ -298,7 +298,7 @@ impl MyEguiApp {
full_url: possible_image.url.clone(),
});
}
let _ = tx.send(FetcStatus::Fetched(result));
let _ = tx.send(FetchStatus::Fetched(result));
}
});
}
Expand Down
8 changes: 4 additions & 4 deletions src/ui/ui_disconnect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ use crate::sync::disconnect_shortcut;
use crate::sync::IsBoilRShortcut;

#[derive(Default)]
pub struct DiconnectState {
pub struct DisconnectState {
pub connected_shortcuts: Option<Result<Vec<ShortcutInfo>, String>>,
}

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)
Expand Down Expand Up @@ -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()
Expand All @@ -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);
}
}
Expand Down
16 changes: 8 additions & 8 deletions src/ui/ui_import_games.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,18 @@ use super::{

const SECTION_SPACING: f32 = 25.0;

pub enum FetcStatus<T> {
pub enum FetchStatus<T> {
NeedsFetched,
Fetching,
Fetched(T),
}

impl<T> FetcStatus<T> {
impl<T> FetchStatus<T> {
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,
}
}
}
Expand All @@ -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(){
Expand Down
Loading
Loading