Pare down to_typename to match usage
diff --git a/gen/write.rs b/gen/write.rs
index f456e18..19762cc 100644
--- a/gen/write.rs
+++ b/gen/write.rs
@@ -889,32 +889,21 @@
}
}
+// Only called for legal referent types of unique_ptr and element types of
+// std::vector and Vec.
fn to_typename(namespace: &Namespace, ty: &Type) -> String {
match ty {
Type::Ident(ident) => {
- let mut inner = String::new();
- // Do not apply namespace to built-in type
- let is_user_type = Atom::from(ident).is_none();
- if is_user_type {
- for name in namespace {
- inner += name;
- inner += "::";
- }
+ let mut path = String::new();
+ for name in namespace {
+ path += name;
+ path += "::";
}
- if let Some(ti) = Atom::from(ident) {
- inner += ti.to_cxx();
- } else {
- inner += &ident.to_string();
- };
- inner
- }
- Type::RustBox(ptr) => format!("rust_box<{}>", to_typename(namespace, &ptr.inner)),
- Type::RustVec(ptr) => format!("rust_vec<{}>", to_typename(namespace, &ptr.inner)),
- Type::UniquePtr(ptr) => {
- format!("::std::unique_ptr<{}>", to_typename(namespace, &ptr.inner))
+ path += &ident.to_string();
+ path
}
Type::CxxVector(ptr) => format!("::std::vector<{}>", to_typename(namespace, &ptr.inner)),
- _ => unimplemented!(),
+ _ => unreachable!(),
}
}