Write OrderedSet using reference syntax
diff --git a/syntax/set.rs b/syntax/set.rs
index 688d1c0..de13088 100644
--- a/syntax/set.rs
+++ b/syntax/set.rs
@@ -2,12 +2,12 @@
use std::hash::Hash;
use std::slice;
-pub struct OrderedSet<'a, T> {
- set: HashSet<&'a T>,
- vec: Vec<&'a T>,
+pub struct OrderedSet<T> {
+ set: HashSet<T>,
+ vec: Vec<T>,
}
-impl<'a, T> OrderedSet<'a, T>
+impl<'a, T> OrderedSet<&'a T>
where
T: Hash + Eq,
{
@@ -31,7 +31,7 @@
}
}
-impl<'s, 'a, T> IntoIterator for &'s OrderedSet<'a, T> {
+impl<'s, 'a, T> IntoIterator for &'s OrderedSet<&'a T> {
type Item = &'a T;
type IntoIter = Iter<'s, 'a, T>;
fn into_iter(self) -> Self::IntoIter {
diff --git a/syntax/types.rs b/syntax/types.rs
index d579c78..ff3d049 100644
--- a/syntax/types.rs
+++ b/syntax/types.rs
@@ -7,11 +7,11 @@
use std::collections::{BTreeMap as Map, HashSet as UnorderedSet};
pub struct Types<'a> {
- pub all: Set<'a, Type>,
+ pub all: Set<&'a Type>,
pub structs: Map<&'a Ident, &'a Struct>,
pub enums: Map<&'a Ident, &'a Enum>,
- pub cxx: Set<'a, Ident>,
- pub rust: Set<'a, Ident>,
+ pub cxx: Set<&'a Ident>,
+ pub rust: Set<&'a Ident>,
pub aliases: Map<&'a Ident, &'a TypeAlias>,
}
@@ -24,7 +24,7 @@
let mut rust = Set::new();
let mut aliases = Map::new();
- fn visit<'a>(all: &mut Set<'a, Type>, ty: &'a Type) {
+ fn visit<'a>(all: &mut Set<&'a Type>, ty: &'a Type) {
all.insert(ty);
match ty {
Type::Ident(_) | Type::Str(_) | Type::Void(_) | Type::SliceRefU8(_) => {}