Skip to content

Commit fe6ec0e

Browse files
Remove unused utility functions
1 parent bffaf66 commit fe6ec0e

File tree

2 files changed

+0
-36
lines changed

2 files changed

+0
-36
lines changed

src/intermediate.rs

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -52,22 +52,6 @@ impl<'a> IntermediateTypes<'a> {
5252
}
5353
}
5454

55-
pub fn has_ident(&self, ident: &RustIdent) -> bool {
56-
let foo: Vec<RustIdent> = self.type_aliases.keys().fold(vec![], |mut acc, alias| {
57-
match alias {
58-
AliasIdent::Reserved(_) => {},
59-
AliasIdent::Rust(ident) => { acc.push(ident.clone()) }
60-
};
61-
acc
62-
});
63-
println!("{:?}", self.plain_groups.keys().chain(foo.iter()).chain(self.rust_structs.keys()).chain(self.generic_defs.keys()).chain(self.generic_instances.keys()));
64-
self.plain_groups.contains_key(ident)
65-
|| self.type_aliases.contains_key(&AliasIdent::Rust(ident.clone()))
66-
|| self.rust_structs.contains_key(ident)
67-
|| self.generic_defs.contains_key(ident)
68-
|| self.generic_instances.contains_key(ident)
69-
}
70-
7155
pub fn type_aliases(&self) -> &BTreeMap<AliasIdent, (RustType, bool, bool)> {
7256
&self.type_aliases
7357
}
@@ -1755,12 +1739,3 @@ impl GenericInstance {
17551739
orig.clone()
17561740
}
17571741
}
1758-
1759-
fn try_ident_with_id(intermediate_types: &IntermediateTypes, name: &CDDLIdent, value: u32) -> CDDLIdent {
1760-
let new_ident = CDDLIdent::new(format!("{}{}", name, value));
1761-
let rust_ident = RustIdent::new(new_ident.clone());
1762-
match intermediate_types.has_ident(&rust_ident) {
1763-
false => new_ident,
1764-
true => try_ident_with_id(intermediate_types, name, value + 1)
1765-
}
1766-
}

src/parsing.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1126,14 +1126,3 @@ fn _has_embed<'a, 'b>(parent_visitor: &'a ParentVisitor, cddl_type: &CDDLType<'a
11261126
_ => false
11271127
}
11281128
}
1129-
1130-
/// A recursive type is defied as one that has a node of the same type in its parent hierarchy
1131-
fn is_recursive<'a, 'b>(parent_visitor: &'a ParentVisitor, cddl_type: &CDDLType<'a, 'b>) -> bool {
1132-
_is_recursive(parent_visitor, &mut HashSet::new(), cddl_type)
1133-
}
1134-
fn _is_recursive<'a, 'b>(parent_visitor: &'a ParentVisitor, seen_set: &mut HashSet<Discriminant<CDDLType<'a, 'b>>>, cddl_type: &CDDLType<'a, 'b>) -> bool {
1135-
match seen_set.insert(std::mem::discriminant(cddl_type)) {
1136-
true => _is_recursive(parent_visitor, seen_set, cddl_type.parent(parent_visitor).unwrap()),
1137-
false => false
1138-
}
1139-
}

0 commit comments

Comments
 (0)