Skip to content
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
3 changes: 1 addition & 2 deletions src/eval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,7 @@ pub fn check_values(
);

Ok(check_result.map(|elems| ratchet::Nixpkgs {
package_names: elems.iter().map(|(name, _)| name.to_owned()).collect(),
package_map: elems.into_iter().collect(),
packages: elems.into_iter().collect(),
}))
}

Expand Down
12 changes: 5 additions & 7 deletions src/ratchet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//!
//! Each type has a `compare` method that validates the ratchet checks for that item.

use std::collections::HashMap;
use std::collections::BTreeMap;

use relative_path::RelativePathBuf;

Expand All @@ -13,10 +13,8 @@ use crate::validation::{self, Validation, Validation::Success};
/// The ratchet value for the entirety of Nixpkgs.
#[derive(Default)]
pub struct Nixpkgs {
/// Sorted list of packages in `package_map`
pub package_names: Vec<String>,
/// The ratchet values for all packages
pub package_map: HashMap<String, Package>,
pub packages: BTreeMap<String, Package>,
}

impl Nixpkgs {
Expand All @@ -25,9 +23,9 @@ impl Nixpkgs {
validation::sequence_(
// We only loop over the current attributes,
// we don't need to check ones that were removed
to.package_names.into_iter().map(|name| {
Package::compare(&name, from.package_map.get(&name), &to.package_map[&name])
}),
to.packages
.into_iter()
.map(|(name, pkg)| Package::compare(&name, from.packages.get(&name), &pkg)),
)
}
}
Expand Down
Loading