diff --git a/crates/aiken-project/src/lib.rs b/crates/aiken-project/src/lib.rs index 212d4545..cea3b478 100644 --- a/crates/aiken-project/src/lib.rs +++ b/crates/aiken-project/src/lib.rs @@ -51,7 +51,7 @@ use pallas::ledger::{ traverse::ComputeHash, }; use std::{ - collections::{HashMap, HashSet}, + collections::{BTreeSet, HashMap}, fs::{self, File}, io::BufReader, path::{Path, PathBuf}, @@ -198,7 +198,7 @@ where let mut modules = self.parse_sources(self.config.name.clone())?; - let our_modules: HashSet = modules.keys().cloned().collect(); + let our_modules: BTreeSet = modules.keys().cloned().collect(); self.with_dependencies(&mut modules)?; @@ -296,7 +296,7 @@ where let mut modules = self.parse_sources(self.config.name.clone())?; - let our_modules: HashSet = modules.keys().cloned().collect(); + let our_modules: BTreeSet = modules.keys().cloned().collect(); self.with_dependencies(&mut modules)?; @@ -684,7 +684,7 @@ where fn type_check( &mut self, - our_modules: &HashSet, + our_modules: &BTreeSet, mut all_modules: ParsedModules, tracing: Tracing, validate_module_name: bool, diff --git a/crates/aiken-project/src/module.rs b/crates/aiken-project/src/module.rs index cf6812e5..5d3f281e 100644 --- a/crates/aiken-project/src/module.rs +++ b/crates/aiken-project/src/module.rs @@ -8,7 +8,7 @@ use aiken_lang::{ }; use petgraph::{algo, graph::NodeIndex, Direction, Graph}; use std::{ - collections::{HashMap, HashSet}, + collections::{BTreeSet, HashMap}, io, ops::{Deref, DerefMut}, path::PathBuf, @@ -47,7 +47,7 @@ impl ParsedModules { Self(HashMap::new()) } - pub fn sequence(&self, our_modules: &HashSet) -> Result, Error> { + pub fn sequence(&self, our_modules: &BTreeSet) -> Result, Error> { let inputs = self .0 .values() @@ -60,7 +60,7 @@ impl ParsedModules { let mut indices = HashMap::with_capacity(capacity); - let mut our_indices = HashSet::with_capacity(our_modules.len()); + let mut our_indices = BTreeSet::new(); for (value, _) in &inputs { let index = graph.add_node(value.to_string()); @@ -90,7 +90,7 @@ impl ParsedModules { // know starting indices for our search, so when we remove a dependency, we need find // back what those indices are. if messed_up_indices { - our_indices = HashSet::with_capacity(our_modules.len()); + our_indices = BTreeSet::new(); for j in graph.node_indices() { if our_modules.contains(graph[j].as_str()) { our_indices.insert(j); @@ -125,7 +125,7 @@ impl ParsedModules { let mut path = vec![]; - find_cycle(origin, origin, &graph, &mut path, &mut HashSet::new()); + find_cycle(origin, origin, &graph, &mut path, &mut BTreeSet::new()); let modules = path .iter() @@ -176,7 +176,7 @@ fn find_cycle( parent: NodeIndex, graph: &petgraph::Graph, path: &mut Vec, - seen: &mut HashSet, + seen: &mut BTreeSet, ) -> bool { seen.insert(parent);