Skip to content

Commit

Permalink
Remove need for ordered_map helper
Browse files Browse the repository at this point in the history
  • Loading branch information
mtkennerly committed Nov 11, 2024
1 parent a9c0e66 commit bb3a9d4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 16 deletions.
5 changes: 4 additions & 1 deletion src/gui/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ impl App {
Task::perform(
async move {
manifest.incorporate_extensions(&config);
let subjects: Vec<_> = if let Some(games) = &games {
let subjects: HashSet<_> = if let Some(games) = &games {
manifest.0.keys().filter(|k| games.contains(*k)).cloned().collect()
} else if !previewed_games.is_empty() && all_scanned {
manifest
Expand All @@ -390,6 +390,9 @@ impl App {
manifest.processable_titles().cloned().collect()
};

// HashSet -> Vec because randomized order looks nicer in the GUI.
let subjects: Vec<_> = subjects.into_iter().collect();

let roots = config.expanded_roots();
let layout = BackupLayout::new(config.backup.path.clone());
let title_finder = TitleFinder::new(&config, &manifest, layout.restorable_game_set());
Expand Down
2 changes: 1 addition & 1 deletion src/resource/manifest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ pub enum Source {
}

#[derive(Clone, Debug, Default, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub struct Manifest(#[serde(serialize_with = "crate::serialization::ordered_map")] pub HashMap<String, Game>);
pub struct Manifest(pub BTreeMap<String, Game>);

#[derive(Clone, Debug, Default, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
#[serde(default, rename_all = "camelCase")]
Expand Down
14 changes: 0 additions & 14 deletions src/serialization.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,3 @@
use std::collections::{BTreeMap, HashMap};

use serde::{Serialize, Serializer};

#[cfg_attr(not(target_os = "windows"), allow(unused))]
pub fn ordered_map<S, V>(value: &HashMap<String, V>, serializer: S) -> Result<S::Ok, S::Error>
where
V: Serialize,
S: Serializer,
{
let ordered: BTreeMap<_, _> = value.iter().collect();
ordered.serialize(serializer)
}

pub const fn default_true() -> bool {
true
}

0 comments on commit bb3a9d4

Please sign in to comment.