Remove constructors in favor of public fields
diff --git a/codegen/src/parse.rs b/codegen/src/parse.rs
index 10872ea..448188d 100644
--- a/codegen/src/parse.rs
+++ b/codegen/src/parse.rs
@@ -86,7 +86,10 @@
_ => panic!("Enum representation not supported"),
};
- types::Variant::new(variant.ident.to_string(), fields)
+ types::Variant {
+ ident: variant.ident.to_string(),
+ fields,
+ }
})
.collect()
}
@@ -132,7 +135,10 @@
_ => panic!(),
};
- types::Type::Punctuated(types::Punctuated::new(nested, punct))
+ types::Type::Punctuated(types::Punctuated {
+ element: Box::new(nested),
+ punct,
+ })
}
"Vec" => {
let nested = introspect_type(first_arg(&last.arguments), items, tokens);
@@ -468,7 +474,7 @@
assert!(input.is_empty());
- Ok(types::Features::new(features))
+ Ok(types::Features { any: features })
}
}
}
diff --git a/codegen/src/types.rs b/codegen/src/types.rs
index e593a66..cc6733c 100644
--- a/codegen/src/types.rs
+++ b/codegen/src/types.rs
@@ -73,29 +73,10 @@
#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)]
pub struct Features {
- any: Vec<String>,
-}
-
-impl Variant {
- pub fn new(ident: String, fields: Vec<Type>) -> Variant {
- Variant { ident, fields }
- }
-}
-
-impl Punctuated {
- pub fn new(element: Type, punct: String) -> Self {
- Punctuated {
- element: Box::new(element),
- punct,
- }
- }
+ pub any: Vec<String>,
}
impl Features {
- pub fn new(any: Vec<String>) -> Features {
- Features { any }
- }
-
pub fn join(&mut self, other: &Features) {
if self.any.is_empty() {
self.any = other.any.clone();