Skip to content

Commit

Permalink
Clippy corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilipK committed Jan 13, 2024
1 parent cccd403 commit 1a922ee
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 31 deletions.
3 changes: 1 addition & 2 deletions src/platforms/playnite/playnite_platform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ impl PlaynitePlatform {
fn get_playnite_games(&self) -> eyre::Result<Vec<PlayniteGame>> {
let mut res = vec![];
let (launcher_path, games_file_path) = self.find_paths()?;
let games_bytes = std::fs::read(&games_file_path).map_err(|e| match e.raw_os_error() {
let games_bytes = std::fs::read(games_file_path).map_err(|e| match e.raw_os_error() {
Some(32) => {
eyre::format_err!("It looks like Playnite is running and preventing BoilR from reading its database, please ensure that Playnite closed.")
}
Expand Down Expand Up @@ -123,7 +123,6 @@ impl PlaynitePlatform {
return Err(eyre::eyre!("Did not find Playnite installation"));
}
let app_data_path = env::var("APPDATA")?;
let launcher_path = launcher_path;
let playnite_folder = Path::new(&app_data_path).join("Playnite");
let games_file_path = playnite_folder.join("library").join("games.db");
Ok((launcher_path, games_file_path))
Expand Down
1 change: 0 additions & 1 deletion src/steam/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ pub fn get_shortcuts_paths(settings: &SteamSettings) -> eyre::Result<Vec<SteamUs
));
}

if !user_data_path.exists() {}
let user_folders = std::fs::read_dir(&user_data_path)?;
let users_info = user_folders
.filter_map(|f| f.ok())
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 @@ -46,7 +46,7 @@ impl<'a> CachedSearch<'a> {
}
println!("Searching for {}", query.as_ref());
let search = self.client.search(query.as_ref()).await?;
let first_id = search.get(0).map(|f| f.id);
let first_id = search.first().map(|f| f.id);
match first_id {
Some(assumed_id) => {
self.search_map.insert(app_id, (query.into(), assumed_id));
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.get(0);
return steam_users.first();
}
}
39 changes: 19 additions & 20 deletions src/ui/images/pages/pick_new_image.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,25 +55,24 @@ pub fn render_page_pick_image(
let x = Grid::new("ImageThumbnailSelectGrid")
.spacing([column_padding, column_padding])
.show(ui, |ui| {
for image in images {
if {
let url: &str = &image.thumbnail_url;
let image = egui::Image::new(url)
.max_width(column_width)
.shrink_to_fit();
let calced = image.calc_size(
egui::Vec2 {
x: column_width,
y: f32::INFINITY,
},
image.size(),
);
let button = ImageButton::new(image);
ui.add_sized(calced, button)
.on_hover_text("Pick image")
.clicked()
} {
return Some(image.clone());
for possible_image in images {
let image = egui::Image::new(&possible_image.thumbnail_url)
.max_width(column_width)
.shrink_to_fit();
let calced = image.calc_size(
egui::Vec2 {
x: column_width,
y: f32::INFINITY,
},
image.size(),
);
let button = ImageButton::new(image);
let clicked = ui
.add_sized(calced, button)
.on_hover_text("Pick image")
.clicked();
if clicked {
return Some(possible_image);
}
column += 1;
if column >= columns {
Expand All @@ -85,7 +84,7 @@ pub fn render_page_pick_image(
})
.inner;
if let Some(x) = x {
return Some(UserAction::ImageSelected(x));
return Some(UserAction::ImageSelected(x.clone()));
}
}
_ => {
Expand Down
2 changes: 0 additions & 2 deletions src/ui/images/ui_image_download.rs
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,6 @@ impl MyEguiApp {
let settings = self.settings.clone();
if let Some(auth_key) = settings.steamgrid_db.auth_key {
if let Some(grid_id) = self.image_selected_state.grid_id {
let auth_key = auth_key;
let image_type = image_type;
self.rt.spawn_blocking(move || {
let thumbnails_folder = get_thumbnails_folder();
let client = steamgriddb_api::Client::new(auth_key);
Expand Down
5 changes: 1 addition & 4 deletions src/ui/uiapp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -322,11 +322,8 @@ pub fn run_ui(args: Vec<String>) -> eyre::Result<()> {
let app = MyEguiApp::new()?;
let no_v_sync = args.contains(&"--no-vsync".to_string());
let fullscreen = is_fullscreen(&args);

let mut viewport = egui::ViewportBuilder::default();
viewport.fullscreen = Some(fullscreen);
let logo = get_logo_icon();
viewport.icon = Some(logo.into());
let viewport = egui::ViewportBuilder { fullscreen: Some(fullscreen), icon: Some(logo.into()), ..Default::default() };
let native_options = eframe::NativeOptions {
viewport,
vsync: !no_v_sync,
Expand Down

0 comments on commit 1a922ee

Please sign in to comment.