From 37a7a0f2e1aea2c6b70f9db67d8f9a8c5e704a78 Mon Sep 17 00:00:00 2001 From: imaqtkatt Date: Wed, 3 Jul 2024 11:55:13 -0300 Subject: [PATCH] Change to use index structures --- src/imp/mod.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/imp/mod.rs b/src/imp/mod.rs index fa2f9504..fe513f1b 100644 --- a/src/imp/mod.rs +++ b/src/imp/mod.rs @@ -3,9 +3,8 @@ mod order_kwargs; pub mod parser; pub mod to_fun; -use std::collections::HashSet; - use crate::fun::{CtrField, Name, Num, Op}; +use indexmap::{IndexMap, IndexSet}; use interner::global::GlobalString; #[derive(Clone, Debug)] @@ -240,12 +239,12 @@ impl InPlaceOp { } pub trait RepeatedNames { - fn find_repeated_names(&self) -> HashSet; + fn find_repeated_names(&self) -> IndexSet; } impl RepeatedNames for Vec { - fn find_repeated_names(&self) -> HashSet { - let mut count = std::collections::HashMap::new(); + fn find_repeated_names(&self) -> IndexSet { + let mut count = IndexMap::new(); for field in self.iter() { *count.entry(field.nam.clone()).or_insert(0) += 1; } @@ -254,7 +253,7 @@ impl RepeatedNames for Vec { } impl RepeatedNames for Variant { - fn find_repeated_names(&self) -> HashSet { + fn find_repeated_names(&self) -> IndexSet { self.fields.find_repeated_names() } }