diff --git a/src/uu/tsort/src/tsort.rs b/src/uu/tsort/src/tsort.rs index a70f32dfdd..6e11a7f580 100644 --- a/src/uu/tsort/src/tsort.rs +++ b/src/uu/tsort/src/tsort.rs @@ -6,7 +6,7 @@ // * For the full copyright and license information, please view the LICENSE // * file that was distributed with this source code. use clap::{crate_version, Arg, Command}; -use std::collections::{HashMap, HashSet}; +use std::collections::{BTreeMap, BTreeSet}; use std::fs::File; use std::io::{stdin, BufRead, BufReader, Read}; use std::path::Path; @@ -103,8 +103,8 @@ pub fn uu_app() -> Command { // but using integer may improve performance. #[derive(Default)] struct Graph { - in_edges: HashMap>, - out_edges: HashMap>, + in_edges: BTreeMap>, + out_edges: BTreeMap>, result: Vec, } @@ -122,7 +122,7 @@ impl Graph { } fn init_node(&mut self, n: &str) { - self.in_edges.insert(n.to_string(), HashSet::new()); + self.in_edges.insert(n.to_string(), BTreeSet::new()); self.out_edges.insert(n.to_string(), vec![]); }