Format codegen with rustfmt 2018-12-10
diff --git a/codegen/src/gen.rs b/codegen/src/gen.rs
index cdd574c..634a07d 100644
--- a/codegen/src/gen.rs
+++ b/codegen/src/gen.rs
@@ -341,9 +341,7 @@
match ty {
types::Type::Box(t) => box_visit(&*t, features, defs, kind, name),
types::Type::Vec(t) => vec_visit(&*t, features, defs, kind, name),
- types::Type::Punctuated(p) => {
- punctuated_visit(p.element(), features, defs, kind, name)
- }
+ types::Type::Punctuated(p) => punctuated_visit(p.element(), features, defs, kind, name),
types::Type::Option(t) => option_visit(&*t, features, defs, kind, name),
types::Type::Tuple(t) => tuple_visit(t, features, defs, kind, name),
types::Type::Token(t) => {
@@ -525,9 +523,8 @@
visit_impl.append_all(quote! {
#visit_field;
});
- let visit_mut_field =
- visit(ty, v.features(), defs, VisitMut, &ref_toks)
- .unwrap_or_else(|| noop_visit(VisitMut, &ref_toks));
+ let visit_mut_field = visit(ty, v.features(), defs, VisitMut, &ref_toks)
+ .unwrap_or_else(|| noop_visit(VisitMut, &ref_toks));
visit_mut_impl.append_all(quote! {
#visit_mut_field;
});
@@ -644,10 +641,10 @@
for &tt in TERMINAL_TYPES {
defs.insert(types::Node::Struct(types::Struct::new(
- tt.to_string(),
- types::Features::default(),
- IndexMap::new())
- ));
+ tt.to_string(),
+ types::Features::default(),
+ IndexMap::new(),
+ )));
}
let mut state = codegen::State::default();
diff --git a/codegen/src/json.rs b/codegen/src/json.rs
index 3bcf7b2..532260e 100644
--- a/codegen/src/json.rs
+++ b/codegen/src/json.rs
@@ -16,11 +16,15 @@
let f = ::std::fs::File::create(codegen_root.join("../syn.json")).unwrap();
- serde_json::to_writer_pretty(f, &Introspect {
- version: &manifest.package.version,
- types: &defs.types,
- tokens: &defs.tokens,
- }).unwrap();
+ serde_json::to_writer_pretty(
+ f,
+ &Introspect {
+ version: &manifest.package.version,
+ types: &defs.types,
+ tokens: &defs.tokens,
+ },
+ )
+ .unwrap();
}
#[derive(Debug, Deserialize)]
diff --git a/codegen/src/parse.rs b/codegen/src/parse.rs
index b43bef5..e38c1e2 100644
--- a/codegen/src/parse.rs
+++ b/codegen/src/parse.rs
@@ -29,7 +29,10 @@
.map(|item| introspect_item(item, &item_lookup, &token_lookup))
.collect();
- let tokens = token_lookup.into_iter().map(|(name, ty)| (ty, name)).collect();
+ let tokens = token_lookup
+ .into_iter()
+ .map(|(name, ty)| (ty, name))
+ .collect();
types::Definitions { types, tokens }
}
@@ -154,7 +157,9 @@
"Brace" | "Bracket" | "Paren" | "Group" => {
types::Type::Group(last.ident.to_string())
}
- "TokenStream" | "Literal" | "Ident" | "Span" => types::Type::Ext(last.ident.to_string()),
+ "TokenStream" | "Literal" | "Ident" | "Span" => {
+ types::Type::Ext(last.ident.to_string())
+ }
"String" | "u32" | "usize" | "bool" => types::Type::Std(last.ident.to_string()),
_ => {
if items.get(&last.ident).is_some() {
diff --git a/codegen/src/types.rs b/codegen/src/types.rs
index de25e6e..f6ed520 100644
--- a/codegen/src/types.rs
+++ b/codegen/src/types.rs
@@ -99,11 +99,7 @@
}
impl Struct {
- pub fn new(
- ident: String,
- features: Features,
- fields: IndexMap<String, Type>,
- ) -> Struct {
+ pub fn new(ident: String, features: Features, fields: IndexMap<String, Type>) -> Struct {
Struct {
ident,
features,
@@ -150,7 +146,10 @@
impl Punctuated {
pub fn new(element: Type, punct: String) -> Self {
- Punctuated { element: Box::new(element), punct }
+ Punctuated {
+ element: Box::new(element),
+ punct,
+ }
}
pub fn element(&self) -> &Type {