From 3e6e68f6eae715833a7be5962d7e0f316ab22656 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20L=C3=BChne?= Date: Sun, 2 Feb 2020 17:39:41 +0100 Subject: [PATCH] Use ordered sets for declarations This replaces the unordered sets used for function and predicate declarations with ordered sets. This is useful when these declarations are supposed to be processed in a stable and meaningful order. --- src/ast.rs | 4 ++-- src/format.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ast.rs b/src/ast.rs index 3cd9326..3cb94e0 100644 --- a/src/ast.rs +++ b/src/ast.rs @@ -47,7 +47,7 @@ impl FunctionDeclaration } } -pub type FunctionDeclarations = std::collections::HashSet>; +pub type FunctionDeclarations = std::collections::BTreeSet>; #[derive(Eq, Hash, Ord, PartialEq, PartialOrd)] pub struct PredicateDeclaration @@ -68,7 +68,7 @@ impl PredicateDeclaration } } -pub type PredicateDeclarations = std::collections::HashSet>; +pub type PredicateDeclarations = std::collections::BTreeSet>; #[derive(Eq, Hash, Ord, PartialEq, PartialOrd)] pub struct VariableDeclaration diff --git a/src/format.rs b/src/format.rs index 1aca79e..b88b8af 100644 --- a/src/format.rs +++ b/src/format.rs @@ -211,7 +211,7 @@ impl<'formula> std::fmt::Debug for FormulaDisplay<'formula> let mut separator = " "; - for parameter in &exists.parameters + for parameter in exists.parameters.iter() { write!(format, "{}{:?}", separator, parameter)?; @@ -226,7 +226,7 @@ impl<'formula> std::fmt::Debug for FormulaDisplay<'formula> let mut separator = " "; - for parameter in &for_all.parameters + for parameter in for_all.parameters.iter() { write!(format, "{}{:?}", separator, parameter)?;