Merge pull request #634 from dtolnay/insta
Switch tests to insta's inline snapshot
diff --git a/Cargo.toml b/Cargo.toml
index c68d3b0..ee631b4 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -38,6 +38,7 @@
[dev-dependencies]
insta = "0.8"
rayon = "1.0"
+ref-cast = "0.2"
regex = "1.0"
termcolor = "1.0"
walkdir = "2.1"
diff --git a/codegen/src/debug.rs b/codegen/src/debug.rs
new file mode 100644
index 0000000..f457810
--- /dev/null
+++ b/codegen/src/debug.rs
@@ -0,0 +1,291 @@
+use crate::error::Result;
+use crate::file;
+use proc_macro2::{Ident, Span, TokenStream};
+use quote::quote;
+use syn::Index;
+use syn_codegen::{Data, Definitions, Node, Type};
+
+const DEBUG_SRC: &str = "../tests/debug/gen.rs";
+
+fn rust_type(ty: &Type) -> TokenStream {
+ match ty {
+ Type::Syn(ty) => {
+ let ident = Ident::new(ty, Span::call_site());
+ quote!(syn::#ident)
+ }
+ Type::Std(ty) => {
+ let ident = Ident::new(ty, Span::call_site());
+ quote!(#ident)
+ }
+ Type::Ext(ty) => {
+ let ident = Ident::new(ty, Span::call_site());
+ quote!(proc_macro2::#ident)
+ }
+ Type::Token(ty) | Type::Group(ty) => {
+ let ident = Ident::new(ty, Span::call_site());
+ quote!(syn::token::#ident)
+ }
+ Type::Punctuated(ty) => {
+ let element = rust_type(&ty.element);
+ let punct = Ident::new(&ty.punct, Span::call_site());
+ quote!(syn::punctuated::Punctuated<#element, #punct>)
+ }
+ Type::Option(ty) => {
+ let inner = rust_type(ty);
+ quote!(Option<#inner>)
+ }
+ Type::Box(ty) => {
+ let inner = rust_type(ty);
+ quote!(Box<#inner>)
+ }
+ Type::Vec(ty) => {
+ let inner = rust_type(ty);
+ quote!(Vec<#inner>)
+ }
+ Type::Tuple(ty) => {
+ let inner = ty.iter().map(rust_type);
+ quote!((#(#inner,)*))
+ }
+ }
+}
+
+fn is_printable(ty: &Type) -> bool {
+ match ty {
+ Type::Ext(name) => name != "Span",
+ Type::Box(ty) => is_printable(ty),
+ Type::Tuple(ty) => ty.iter().any(is_printable),
+ Type::Token(_) | Type::Group(_) => false,
+ Type::Syn(_) | Type::Std(_) | Type::Punctuated(_) | Type::Option(_) | Type::Vec(_) => true,
+ }
+}
+
+fn format_field(val: &TokenStream, ty: &Type) -> Option<TokenStream> {
+ if !is_printable(ty) {
+ return None;
+ }
+ let format = match ty {
+ Type::Option(ty) => {
+ let inner = quote!(_val);
+ let format = format_field(&inner, ty).map(|format| {
+ quote! {
+ formatter.write_str("(")?;
+ Debug::fmt(#format, formatter)?;
+ formatter.write_str(")")?;
+ }
+ });
+ let ty = rust_type(ty);
+ quote!({
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(Option<#ty>);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ match &self.0 {
+ Some(#inner) => {
+ formatter.write_str("Some")?;
+ #format
+ Ok(())
+ }
+ None => formatter.write_str("None"),
+ }
+ }
+ }
+ Print::ref_cast(#val)
+ })
+ }
+ Type::Tuple(ty) => {
+ let printable: Vec<TokenStream> = ty
+ .iter()
+ .enumerate()
+ .filter_map(|(i, ty)| {
+ let index = Index::from(i);
+ let val = quote!(&#val.#index);
+ format_field(&val, ty)
+ })
+ .collect();
+ if printable.len() == 1 {
+ printable.into_iter().next().unwrap()
+ } else {
+ quote! {
+ &(#(#printable),*)
+ }
+ }
+ }
+ _ => quote! { Lite(#val) },
+ };
+ Some(format)
+}
+
+fn syntax_tree_enum<'a>(outer: &str, inner: &str, fields: &'a [Type]) -> Option<&'a str> {
+ if fields.len() != 1 {
+ return None;
+ }
+ const WHITELIST: &[&str] = &["PathArguments", "Visibility"];
+ match &fields[0] {
+ Type::Syn(ty) if WHITELIST.contains(&outer) || outer.to_owned() + inner == *ty => Some(ty),
+ _ => None,
+ }
+}
+
+fn lookup<'a>(defs: &'a Definitions, name: &str) -> &'a Node {
+ for node in &defs.types {
+ if node.ident == name {
+ return node;
+ }
+ }
+ panic!("not found: {}", name)
+}
+
+fn expand_impl_body(defs: &Definitions, node: &Node, name: &str) -> TokenStream {
+ let ident = Ident::new(&node.ident, Span::call_site());
+
+ match &node.data {
+ Data::Enum(variants) => {
+ let arms = variants.iter().map(|(v, fields)| {
+ let variant = Ident::new(v, Span::call_site());
+ if fields.is_empty() {
+ quote! {
+ syn::#ident::#variant => formatter.write_str(#v),
+ }
+ } else if let Some(inner) = syntax_tree_enum(name, v, fields) {
+ let path = format!("{}::{}", name, v);
+ let format = expand_impl_body(defs, lookup(defs, inner), &path);
+ quote! {
+ syn::#ident::#variant(_val) => {
+ #format
+ }
+ }
+ } else if fields.len() == 1 {
+ let ty = &fields[0];
+ let val = quote!(_val);
+ let format = format_field(&val, ty).map(|format| {
+ quote! {
+ formatter.write_str("(")?;
+ Debug::fmt(#format, formatter)?;
+ formatter.write_str(")")?;
+ }
+ });
+ quote! {
+ syn::#ident::#variant(_val) => {
+ formatter.write_str(#v)?;
+ #format
+ Ok(())
+ }
+ }
+ } else {
+ let pats = (0..fields.len())
+ .map(|i| Ident::new(&format!("_v{}", i), Span::call_site()));
+ let fields = fields.iter().enumerate().filter_map(|(i, ty)| {
+ let index = Ident::new(&format!("_v{}", i), Span::call_site());
+ let val = quote!(#index);
+ let format = format_field(&val, ty)?;
+ Some(quote! {
+ formatter.field(#format);
+ })
+ });
+ quote! {
+ syn::#ident::#variant(#(#pats),*) => {
+ let mut formatter = formatter.debug_tuple(#v);
+ #(#fields)*
+ formatter.finish()
+ }
+ }
+ }
+ });
+ quote! {
+ match _val {
+ #(#arms)*
+ }
+ }
+ }
+ Data::Struct(fields) => {
+ let fields = fields.iter().filter_map(|(f, ty)| {
+ let ident = Ident::new(f, Span::call_site());
+ if let Type::Option(ty) = ty {
+ let inner = quote!(_val);
+ let format = format_field(&inner, ty).map(|format| {
+ quote! {
+ let #inner = &self.0;
+ formatter.write_str("(")?;
+ Debug::fmt(#format, formatter)?;
+ formatter.write_str(")")?;
+ }
+ });
+ let ty = rust_type(ty);
+ Some(quote! {
+ if let Some(val) = &_val.#ident {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(#ty);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ #format
+ Ok(())
+ }
+ }
+ formatter.field(#f, Print::ref_cast(val));
+ }
+ })
+ } else {
+ let val = quote!(&_val.#ident);
+ let format = format_field(&val, ty)?;
+ let mut call = quote! {
+ formatter.field(#f, #format);
+ };
+ if let Type::Vec(_) | Type::Punctuated(_) = ty {
+ call = quote! {
+ if !_val.#ident.is_empty() {
+ #call
+ }
+ };
+ }
+ Some(call)
+ }
+ });
+ quote! {
+ let mut formatter = formatter.debug_struct(#name);
+ #(#fields)*
+ formatter.finish()
+ }
+ }
+ Data::Private => {
+ quote! {
+ write!(formatter, "{:?}", _val.value())
+ }
+ }
+ }
+}
+
+fn expand_impl(defs: &Definitions, node: &Node) -> TokenStream {
+ let ident = Ident::new(&node.ident, Span::call_site());
+ let body = expand_impl_body(defs, node, &node.ident);
+
+ quote! {
+ impl Debug for Lite<syn::#ident> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ #body
+ }
+ }
+ }
+}
+
+pub fn generate(defs: &Definitions) -> Result<()> {
+ let mut impls = TokenStream::new();
+ for node in &defs.types {
+ impls.extend(expand_impl(&defs, node));
+ }
+
+ file::write(
+ DEBUG_SRC,
+ quote! {
+ use super::{Lite, RefCast};
+ use std::fmt::{self, Debug};
+
+ #impls
+ },
+ )?;
+
+ Ok(())
+}
diff --git a/codegen/src/main.rs b/codegen/src/main.rs
index 3e27e1e..3dc7383 100644
--- a/codegen/src/main.rs
+++ b/codegen/src/main.rs
@@ -12,6 +12,7 @@
#![recursion_limit = "128"]
#![allow(clippy::needless_pass_by_value)]
+mod debug;
mod error;
mod file;
mod fold;
@@ -40,5 +41,6 @@
fold::generate(&defs)?;
visit::generate(&defs)?;
visit_mut::generate(&defs)?;
+ debug::generate(&defs)?;
Ok(())
}
diff --git a/tests/debug/gen.rs b/tests/debug/gen.rs
new file mode 100644
index 0000000..7ac0679
--- /dev/null
+++ b/tests/debug/gen.rs
@@ -0,0 +1,5934 @@
+// This file is @generated by syn-internal-codegen.
+// It is not intended for manual editing.
+
+use super::{Lite, RefCast};
+use std::fmt::{self, Debug};
+impl Debug for Lite<syn::Abi> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("Abi");
+ if let Some(val) = &_val.name {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::LitStr);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ let _val = &self.0;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(_val), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ }
+ formatter.field("name", Print::ref_cast(val));
+ }
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::AngleBracketedGenericArguments> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("AngleBracketedGenericArguments");
+ if let Some(val) = &_val.colon2_token {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Colon2);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("colon2_token", Print::ref_cast(val));
+ }
+ if !_val.args.is_empty() {
+ formatter.field("args", Lite(&_val.args));
+ }
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::ArgCaptured> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("ArgCaptured");
+ formatter.field("pat", Lite(&_val.pat));
+ formatter.field("ty", Lite(&_val.ty));
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::ArgSelf> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("ArgSelf");
+ if let Some(val) = &_val.mutability {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Mut);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("mutability", Print::ref_cast(val));
+ }
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::ArgSelfRef> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("ArgSelfRef");
+ if let Some(val) = &_val.lifetime {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::Lifetime);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ let _val = &self.0;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(_val), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ }
+ formatter.field("lifetime", Print::ref_cast(val));
+ }
+ if let Some(val) = &_val.mutability {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Mut);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("mutability", Print::ref_cast(val));
+ }
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::Arm> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("Arm");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ if let Some(val) = &_val.leading_vert {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Or);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("leading_vert", Print::ref_cast(val));
+ }
+ if !_val.pats.is_empty() {
+ formatter.field("pats", Lite(&_val.pats));
+ }
+ if let Some(val) = &_val.guard {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print((syn::token::If, Box<syn::Expr>));
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ let _val = &self.0;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(&_val.1), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ }
+ formatter.field("guard", Print::ref_cast(val));
+ }
+ formatter.field("body", Lite(&_val.body));
+ if let Some(val) = &_val.comma {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Comma);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("comma", Print::ref_cast(val));
+ }
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::AttrStyle> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ match _val {
+ syn::AttrStyle::Outer => formatter.write_str("Outer"),
+ syn::AttrStyle::Inner(_val) => {
+ formatter.write_str("Inner")?;
+ Ok(())
+ }
+ }
+ }
+}
+impl Debug for Lite<syn::Attribute> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("Attribute");
+ formatter.field("style", Lite(&_val.style));
+ formatter.field("path", Lite(&_val.path));
+ formatter.field("tts", Lite(&_val.tts));
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::BareFnArg> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("BareFnArg");
+ if let Some(val) = &_val.name {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print((syn::BareFnArgName, syn::token::Colon));
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ let _val = &self.0;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(&_val.0), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ }
+ formatter.field("name", Print::ref_cast(val));
+ }
+ formatter.field("ty", Lite(&_val.ty));
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::BareFnArgName> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ match _val {
+ syn::BareFnArgName::Named(_val) => {
+ formatter.write_str("Named")?;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(_val), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ syn::BareFnArgName::Wild(_val) => {
+ formatter.write_str("Wild")?;
+ Ok(())
+ }
+ }
+ }
+}
+impl Debug for Lite<syn::BinOp> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ match _val {
+ syn::BinOp::Add(_val) => {
+ formatter.write_str("Add")?;
+ Ok(())
+ }
+ syn::BinOp::Sub(_val) => {
+ formatter.write_str("Sub")?;
+ Ok(())
+ }
+ syn::BinOp::Mul(_val) => {
+ formatter.write_str("Mul")?;
+ Ok(())
+ }
+ syn::BinOp::Div(_val) => {
+ formatter.write_str("Div")?;
+ Ok(())
+ }
+ syn::BinOp::Rem(_val) => {
+ formatter.write_str("Rem")?;
+ Ok(())
+ }
+ syn::BinOp::And(_val) => {
+ formatter.write_str("And")?;
+ Ok(())
+ }
+ syn::BinOp::Or(_val) => {
+ formatter.write_str("Or")?;
+ Ok(())
+ }
+ syn::BinOp::BitXor(_val) => {
+ formatter.write_str("BitXor")?;
+ Ok(())
+ }
+ syn::BinOp::BitAnd(_val) => {
+ formatter.write_str("BitAnd")?;
+ Ok(())
+ }
+ syn::BinOp::BitOr(_val) => {
+ formatter.write_str("BitOr")?;
+ Ok(())
+ }
+ syn::BinOp::Shl(_val) => {
+ formatter.write_str("Shl")?;
+ Ok(())
+ }
+ syn::BinOp::Shr(_val) => {
+ formatter.write_str("Shr")?;
+ Ok(())
+ }
+ syn::BinOp::Eq(_val) => {
+ formatter.write_str("Eq")?;
+ Ok(())
+ }
+ syn::BinOp::Lt(_val) => {
+ formatter.write_str("Lt")?;
+ Ok(())
+ }
+ syn::BinOp::Le(_val) => {
+ formatter.write_str("Le")?;
+ Ok(())
+ }
+ syn::BinOp::Ne(_val) => {
+ formatter.write_str("Ne")?;
+ Ok(())
+ }
+ syn::BinOp::Ge(_val) => {
+ formatter.write_str("Ge")?;
+ Ok(())
+ }
+ syn::BinOp::Gt(_val) => {
+ formatter.write_str("Gt")?;
+ Ok(())
+ }
+ syn::BinOp::AddEq(_val) => {
+ formatter.write_str("AddEq")?;
+ Ok(())
+ }
+ syn::BinOp::SubEq(_val) => {
+ formatter.write_str("SubEq")?;
+ Ok(())
+ }
+ syn::BinOp::MulEq(_val) => {
+ formatter.write_str("MulEq")?;
+ Ok(())
+ }
+ syn::BinOp::DivEq(_val) => {
+ formatter.write_str("DivEq")?;
+ Ok(())
+ }
+ syn::BinOp::RemEq(_val) => {
+ formatter.write_str("RemEq")?;
+ Ok(())
+ }
+ syn::BinOp::BitXorEq(_val) => {
+ formatter.write_str("BitXorEq")?;
+ Ok(())
+ }
+ syn::BinOp::BitAndEq(_val) => {
+ formatter.write_str("BitAndEq")?;
+ Ok(())
+ }
+ syn::BinOp::BitOrEq(_val) => {
+ formatter.write_str("BitOrEq")?;
+ Ok(())
+ }
+ syn::BinOp::ShlEq(_val) => {
+ formatter.write_str("ShlEq")?;
+ Ok(())
+ }
+ syn::BinOp::ShrEq(_val) => {
+ formatter.write_str("ShrEq")?;
+ Ok(())
+ }
+ }
+ }
+}
+impl Debug for Lite<syn::Binding> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("Binding");
+ formatter.field("ident", Lite(&_val.ident));
+ formatter.field("ty", Lite(&_val.ty));
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::Block> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("Block");
+ if !_val.stmts.is_empty() {
+ formatter.field("stmts", Lite(&_val.stmts));
+ }
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::BoundLifetimes> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("BoundLifetimes");
+ if !_val.lifetimes.is_empty() {
+ formatter.field("lifetimes", Lite(&_val.lifetimes));
+ }
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::ConstParam> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("ConstParam");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("ident", Lite(&_val.ident));
+ formatter.field("ty", Lite(&_val.ty));
+ if let Some(val) = &_val.eq_token {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Eq);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("eq_token", Print::ref_cast(val));
+ }
+ if let Some(val) = &_val.default {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::Expr);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ let _val = &self.0;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(_val), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ }
+ formatter.field("default", Print::ref_cast(val));
+ }
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::Constraint> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("Constraint");
+ formatter.field("ident", Lite(&_val.ident));
+ if !_val.bounds.is_empty() {
+ formatter.field("bounds", Lite(&_val.bounds));
+ }
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::Data> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ match _val {
+ syn::Data::Struct(_val) => {
+ let mut formatter = formatter.debug_struct("Data::Struct");
+ formatter.field("fields", Lite(&_val.fields));
+ if let Some(val) = &_val.semi_token {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Semi);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("semi_token", Print::ref_cast(val));
+ }
+ formatter.finish()
+ }
+ syn::Data::Enum(_val) => {
+ let mut formatter = formatter.debug_struct("Data::Enum");
+ if !_val.variants.is_empty() {
+ formatter.field("variants", Lite(&_val.variants));
+ }
+ formatter.finish()
+ }
+ syn::Data::Union(_val) => {
+ let mut formatter = formatter.debug_struct("Data::Union");
+ formatter.field("fields", Lite(&_val.fields));
+ formatter.finish()
+ }
+ }
+ }
+}
+impl Debug for Lite<syn::DataEnum> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("DataEnum");
+ if !_val.variants.is_empty() {
+ formatter.field("variants", Lite(&_val.variants));
+ }
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::DataStruct> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("DataStruct");
+ formatter.field("fields", Lite(&_val.fields));
+ if let Some(val) = &_val.semi_token {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Semi);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("semi_token", Print::ref_cast(val));
+ }
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::DataUnion> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("DataUnion");
+ formatter.field("fields", Lite(&_val.fields));
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::DeriveInput> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("DeriveInput");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("vis", Lite(&_val.vis));
+ formatter.field("ident", Lite(&_val.ident));
+ formatter.field("generics", Lite(&_val.generics));
+ formatter.field("data", Lite(&_val.data));
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::Expr> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ match _val {
+ syn::Expr::Box(_val) => {
+ let mut formatter = formatter.debug_struct("Expr::Box");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("expr", Lite(&_val.expr));
+ formatter.finish()
+ }
+ syn::Expr::InPlace(_val) => {
+ let mut formatter = formatter.debug_struct("Expr::InPlace");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("place", Lite(&_val.place));
+ formatter.field("value", Lite(&_val.value));
+ formatter.finish()
+ }
+ syn::Expr::Array(_val) => {
+ let mut formatter = formatter.debug_struct("Expr::Array");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ if !_val.elems.is_empty() {
+ formatter.field("elems", Lite(&_val.elems));
+ }
+ formatter.finish()
+ }
+ syn::Expr::Call(_val) => {
+ let mut formatter = formatter.debug_struct("Expr::Call");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("func", Lite(&_val.func));
+ if !_val.args.is_empty() {
+ formatter.field("args", Lite(&_val.args));
+ }
+ formatter.finish()
+ }
+ syn::Expr::MethodCall(_val) => {
+ let mut formatter = formatter.debug_struct("Expr::MethodCall");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("receiver", Lite(&_val.receiver));
+ formatter.field("method", Lite(&_val.method));
+ if let Some(val) = &_val.turbofish {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::MethodTurbofish);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ let _val = &self.0;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(_val), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ }
+ formatter.field("turbofish", Print::ref_cast(val));
+ }
+ if !_val.args.is_empty() {
+ formatter.field("args", Lite(&_val.args));
+ }
+ formatter.finish()
+ }
+ syn::Expr::Tuple(_val) => {
+ let mut formatter = formatter.debug_struct("Expr::Tuple");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ if !_val.elems.is_empty() {
+ formatter.field("elems", Lite(&_val.elems));
+ }
+ formatter.finish()
+ }
+ syn::Expr::Binary(_val) => {
+ let mut formatter = formatter.debug_struct("Expr::Binary");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("left", Lite(&_val.left));
+ formatter.field("op", Lite(&_val.op));
+ formatter.field("right", Lite(&_val.right));
+ formatter.finish()
+ }
+ syn::Expr::Unary(_val) => {
+ let mut formatter = formatter.debug_struct("Expr::Unary");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("op", Lite(&_val.op));
+ formatter.field("expr", Lite(&_val.expr));
+ formatter.finish()
+ }
+ syn::Expr::Lit(_val) => {
+ let mut formatter = formatter.debug_struct("Expr::Lit");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("lit", Lite(&_val.lit));
+ formatter.finish()
+ }
+ syn::Expr::Cast(_val) => {
+ let mut formatter = formatter.debug_struct("Expr::Cast");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("expr", Lite(&_val.expr));
+ formatter.field("ty", Lite(&_val.ty));
+ formatter.finish()
+ }
+ syn::Expr::Type(_val) => {
+ let mut formatter = formatter.debug_struct("Expr::Type");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("expr", Lite(&_val.expr));
+ formatter.field("ty", Lite(&_val.ty));
+ formatter.finish()
+ }
+ syn::Expr::Let(_val) => {
+ let mut formatter = formatter.debug_struct("Expr::Let");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ if !_val.pats.is_empty() {
+ formatter.field("pats", Lite(&_val.pats));
+ }
+ formatter.field("expr", Lite(&_val.expr));
+ formatter.finish()
+ }
+ syn::Expr::If(_val) => {
+ let mut formatter = formatter.debug_struct("Expr::If");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("cond", Lite(&_val.cond));
+ formatter.field("then_branch", Lite(&_val.then_branch));
+ if let Some(val) = &_val.else_branch {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print((syn::token::Else, Box<syn::Expr>));
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ let _val = &self.0;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(&_val.1), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ }
+ formatter.field("else_branch", Print::ref_cast(val));
+ }
+ formatter.finish()
+ }
+ syn::Expr::While(_val) => {
+ let mut formatter = formatter.debug_struct("Expr::While");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ if let Some(val) = &_val.label {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::Label);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ let _val = &self.0;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(_val), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ }
+ formatter.field("label", Print::ref_cast(val));
+ }
+ formatter.field("cond", Lite(&_val.cond));
+ formatter.field("body", Lite(&_val.body));
+ formatter.finish()
+ }
+ syn::Expr::ForLoop(_val) => {
+ let mut formatter = formatter.debug_struct("Expr::ForLoop");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ if let Some(val) = &_val.label {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::Label);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ let _val = &self.0;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(_val), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ }
+ formatter.field("label", Print::ref_cast(val));
+ }
+ formatter.field("pat", Lite(&_val.pat));
+ formatter.field("expr", Lite(&_val.expr));
+ formatter.field("body", Lite(&_val.body));
+ formatter.finish()
+ }
+ syn::Expr::Loop(_val) => {
+ let mut formatter = formatter.debug_struct("Expr::Loop");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ if let Some(val) = &_val.label {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::Label);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ let _val = &self.0;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(_val), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ }
+ formatter.field("label", Print::ref_cast(val));
+ }
+ formatter.field("body", Lite(&_val.body));
+ formatter.finish()
+ }
+ syn::Expr::Match(_val) => {
+ let mut formatter = formatter.debug_struct("Expr::Match");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("expr", Lite(&_val.expr));
+ if !_val.arms.is_empty() {
+ formatter.field("arms", Lite(&_val.arms));
+ }
+ formatter.finish()
+ }
+ syn::Expr::Closure(_val) => {
+ let mut formatter = formatter.debug_struct("Expr::Closure");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ if let Some(val) = &_val.asyncness {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Async);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("asyncness", Print::ref_cast(val));
+ }
+ if let Some(val) = &_val.movability {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Static);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("movability", Print::ref_cast(val));
+ }
+ if let Some(val) = &_val.capture {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Move);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("capture", Print::ref_cast(val));
+ }
+ if !_val.inputs.is_empty() {
+ formatter.field("inputs", Lite(&_val.inputs));
+ }
+ formatter.field("output", Lite(&_val.output));
+ formatter.field("body", Lite(&_val.body));
+ formatter.finish()
+ }
+ syn::Expr::Unsafe(_val) => {
+ let mut formatter = formatter.debug_struct("Expr::Unsafe");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("block", Lite(&_val.block));
+ formatter.finish()
+ }
+ syn::Expr::Block(_val) => {
+ let mut formatter = formatter.debug_struct("Expr::Block");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ if let Some(val) = &_val.label {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::Label);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ let _val = &self.0;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(_val), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ }
+ formatter.field("label", Print::ref_cast(val));
+ }
+ formatter.field("block", Lite(&_val.block));
+ formatter.finish()
+ }
+ syn::Expr::Assign(_val) => {
+ let mut formatter = formatter.debug_struct("Expr::Assign");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("left", Lite(&_val.left));
+ formatter.field("right", Lite(&_val.right));
+ formatter.finish()
+ }
+ syn::Expr::AssignOp(_val) => {
+ let mut formatter = formatter.debug_struct("Expr::AssignOp");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("left", Lite(&_val.left));
+ formatter.field("op", Lite(&_val.op));
+ formatter.field("right", Lite(&_val.right));
+ formatter.finish()
+ }
+ syn::Expr::Field(_val) => {
+ let mut formatter = formatter.debug_struct("Expr::Field");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("base", Lite(&_val.base));
+ formatter.field("member", Lite(&_val.member));
+ formatter.finish()
+ }
+ syn::Expr::Index(_val) => {
+ let mut formatter = formatter.debug_struct("Expr::Index");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("expr", Lite(&_val.expr));
+ formatter.field("index", Lite(&_val.index));
+ formatter.finish()
+ }
+ syn::Expr::Range(_val) => {
+ let mut formatter = formatter.debug_struct("Expr::Range");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ if let Some(val) = &_val.from {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(Box<syn::Expr>);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ let _val = &self.0;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(_val), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ }
+ formatter.field("from", Print::ref_cast(val));
+ }
+ formatter.field("limits", Lite(&_val.limits));
+ if let Some(val) = &_val.to {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(Box<syn::Expr>);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ let _val = &self.0;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(_val), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ }
+ formatter.field("to", Print::ref_cast(val));
+ }
+ formatter.finish()
+ }
+ syn::Expr::Path(_val) => {
+ let mut formatter = formatter.debug_struct("Expr::Path");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ if let Some(val) = &_val.qself {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::QSelf);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ let _val = &self.0;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(_val), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ }
+ formatter.field("qself", Print::ref_cast(val));
+ }
+ formatter.field("path", Lite(&_val.path));
+ formatter.finish()
+ }
+ syn::Expr::Reference(_val) => {
+ let mut formatter = formatter.debug_struct("Expr::Reference");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ if let Some(val) = &_val.mutability {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Mut);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("mutability", Print::ref_cast(val));
+ }
+ formatter.field("expr", Lite(&_val.expr));
+ formatter.finish()
+ }
+ syn::Expr::Break(_val) => {
+ let mut formatter = formatter.debug_struct("Expr::Break");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ if let Some(val) = &_val.label {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::Lifetime);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ let _val = &self.0;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(_val), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ }
+ formatter.field("label", Print::ref_cast(val));
+ }
+ if let Some(val) = &_val.expr {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(Box<syn::Expr>);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ let _val = &self.0;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(_val), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ }
+ formatter.field("expr", Print::ref_cast(val));
+ }
+ formatter.finish()
+ }
+ syn::Expr::Continue(_val) => {
+ let mut formatter = formatter.debug_struct("Expr::Continue");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ if let Some(val) = &_val.label {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::Lifetime);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ let _val = &self.0;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(_val), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ }
+ formatter.field("label", Print::ref_cast(val));
+ }
+ formatter.finish()
+ }
+ syn::Expr::Return(_val) => {
+ let mut formatter = formatter.debug_struct("Expr::Return");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ if let Some(val) = &_val.expr {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(Box<syn::Expr>);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ let _val = &self.0;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(_val), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ }
+ formatter.field("expr", Print::ref_cast(val));
+ }
+ formatter.finish()
+ }
+ syn::Expr::Macro(_val) => {
+ let mut formatter = formatter.debug_struct("Expr::Macro");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("mac", Lite(&_val.mac));
+ formatter.finish()
+ }
+ syn::Expr::Struct(_val) => {
+ let mut formatter = formatter.debug_struct("Expr::Struct");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("path", Lite(&_val.path));
+ if !_val.fields.is_empty() {
+ formatter.field("fields", Lite(&_val.fields));
+ }
+ if let Some(val) = &_val.dot2_token {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Dot2);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("dot2_token", Print::ref_cast(val));
+ }
+ if let Some(val) = &_val.rest {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(Box<syn::Expr>);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ let _val = &self.0;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(_val), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ }
+ formatter.field("rest", Print::ref_cast(val));
+ }
+ formatter.finish()
+ }
+ syn::Expr::Repeat(_val) => {
+ let mut formatter = formatter.debug_struct("Expr::Repeat");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("expr", Lite(&_val.expr));
+ formatter.field("len", Lite(&_val.len));
+ formatter.finish()
+ }
+ syn::Expr::Paren(_val) => {
+ let mut formatter = formatter.debug_struct("Expr::Paren");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("expr", Lite(&_val.expr));
+ formatter.finish()
+ }
+ syn::Expr::Group(_val) => {
+ let mut formatter = formatter.debug_struct("Expr::Group");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("expr", Lite(&_val.expr));
+ formatter.finish()
+ }
+ syn::Expr::Try(_val) => {
+ let mut formatter = formatter.debug_struct("Expr::Try");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("expr", Lite(&_val.expr));
+ formatter.finish()
+ }
+ syn::Expr::Async(_val) => {
+ let mut formatter = formatter.debug_struct("Expr::Async");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ if let Some(val) = &_val.capture {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Move);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("capture", Print::ref_cast(val));
+ }
+ formatter.field("block", Lite(&_val.block));
+ formatter.finish()
+ }
+ syn::Expr::TryBlock(_val) => {
+ let mut formatter = formatter.debug_struct("Expr::TryBlock");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("block", Lite(&_val.block));
+ formatter.finish()
+ }
+ syn::Expr::Yield(_val) => {
+ let mut formatter = formatter.debug_struct("Expr::Yield");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ if let Some(val) = &_val.expr {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(Box<syn::Expr>);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ let _val = &self.0;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(_val), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ }
+ formatter.field("expr", Print::ref_cast(val));
+ }
+ formatter.finish()
+ }
+ syn::Expr::Verbatim(_val) => {
+ let mut formatter = formatter.debug_struct("Expr::Verbatim");
+ formatter.field("tts", Lite(&_val.tts));
+ formatter.finish()
+ }
+ }
+ }
+}
+impl Debug for Lite<syn::ExprArray> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("ExprArray");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ if !_val.elems.is_empty() {
+ formatter.field("elems", Lite(&_val.elems));
+ }
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::ExprAssign> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("ExprAssign");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("left", Lite(&_val.left));
+ formatter.field("right", Lite(&_val.right));
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::ExprAssignOp> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("ExprAssignOp");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("left", Lite(&_val.left));
+ formatter.field("op", Lite(&_val.op));
+ formatter.field("right", Lite(&_val.right));
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::ExprAsync> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("ExprAsync");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ if let Some(val) = &_val.capture {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Move);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("capture", Print::ref_cast(val));
+ }
+ formatter.field("block", Lite(&_val.block));
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::ExprBinary> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("ExprBinary");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("left", Lite(&_val.left));
+ formatter.field("op", Lite(&_val.op));
+ formatter.field("right", Lite(&_val.right));
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::ExprBlock> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("ExprBlock");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ if let Some(val) = &_val.label {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::Label);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ let _val = &self.0;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(_val), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ }
+ formatter.field("label", Print::ref_cast(val));
+ }
+ formatter.field("block", Lite(&_val.block));
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::ExprBox> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("ExprBox");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("expr", Lite(&_val.expr));
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::ExprBreak> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("ExprBreak");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ if let Some(val) = &_val.label {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::Lifetime);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ let _val = &self.0;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(_val), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ }
+ formatter.field("label", Print::ref_cast(val));
+ }
+ if let Some(val) = &_val.expr {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(Box<syn::Expr>);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ let _val = &self.0;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(_val), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ }
+ formatter.field("expr", Print::ref_cast(val));
+ }
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::ExprCall> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("ExprCall");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("func", Lite(&_val.func));
+ if !_val.args.is_empty() {
+ formatter.field("args", Lite(&_val.args));
+ }
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::ExprCast> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("ExprCast");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("expr", Lite(&_val.expr));
+ formatter.field("ty", Lite(&_val.ty));
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::ExprClosure> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("ExprClosure");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ if let Some(val) = &_val.asyncness {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Async);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("asyncness", Print::ref_cast(val));
+ }
+ if let Some(val) = &_val.movability {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Static);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("movability", Print::ref_cast(val));
+ }
+ if let Some(val) = &_val.capture {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Move);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("capture", Print::ref_cast(val));
+ }
+ if !_val.inputs.is_empty() {
+ formatter.field("inputs", Lite(&_val.inputs));
+ }
+ formatter.field("output", Lite(&_val.output));
+ formatter.field("body", Lite(&_val.body));
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::ExprContinue> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("ExprContinue");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ if let Some(val) = &_val.label {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::Lifetime);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ let _val = &self.0;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(_val), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ }
+ formatter.field("label", Print::ref_cast(val));
+ }
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::ExprField> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("ExprField");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("base", Lite(&_val.base));
+ formatter.field("member", Lite(&_val.member));
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::ExprForLoop> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("ExprForLoop");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ if let Some(val) = &_val.label {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::Label);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ let _val = &self.0;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(_val), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ }
+ formatter.field("label", Print::ref_cast(val));
+ }
+ formatter.field("pat", Lite(&_val.pat));
+ formatter.field("expr", Lite(&_val.expr));
+ formatter.field("body", Lite(&_val.body));
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::ExprGroup> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("ExprGroup");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("expr", Lite(&_val.expr));
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::ExprIf> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("ExprIf");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("cond", Lite(&_val.cond));
+ formatter.field("then_branch", Lite(&_val.then_branch));
+ if let Some(val) = &_val.else_branch {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print((syn::token::Else, Box<syn::Expr>));
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ let _val = &self.0;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(&_val.1), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ }
+ formatter.field("else_branch", Print::ref_cast(val));
+ }
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::ExprInPlace> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("ExprInPlace");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("place", Lite(&_val.place));
+ formatter.field("value", Lite(&_val.value));
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::ExprIndex> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("ExprIndex");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("expr", Lite(&_val.expr));
+ formatter.field("index", Lite(&_val.index));
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::ExprLet> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("ExprLet");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ if !_val.pats.is_empty() {
+ formatter.field("pats", Lite(&_val.pats));
+ }
+ formatter.field("expr", Lite(&_val.expr));
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::ExprLit> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("ExprLit");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("lit", Lite(&_val.lit));
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::ExprLoop> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("ExprLoop");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ if let Some(val) = &_val.label {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::Label);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ let _val = &self.0;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(_val), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ }
+ formatter.field("label", Print::ref_cast(val));
+ }
+ formatter.field("body", Lite(&_val.body));
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::ExprMacro> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("ExprMacro");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("mac", Lite(&_val.mac));
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::ExprMatch> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("ExprMatch");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("expr", Lite(&_val.expr));
+ if !_val.arms.is_empty() {
+ formatter.field("arms", Lite(&_val.arms));
+ }
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::ExprMethodCall> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("ExprMethodCall");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("receiver", Lite(&_val.receiver));
+ formatter.field("method", Lite(&_val.method));
+ if let Some(val) = &_val.turbofish {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::MethodTurbofish);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ let _val = &self.0;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(_val), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ }
+ formatter.field("turbofish", Print::ref_cast(val));
+ }
+ if !_val.args.is_empty() {
+ formatter.field("args", Lite(&_val.args));
+ }
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::ExprParen> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("ExprParen");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("expr", Lite(&_val.expr));
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::ExprPath> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("ExprPath");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ if let Some(val) = &_val.qself {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::QSelf);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ let _val = &self.0;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(_val), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ }
+ formatter.field("qself", Print::ref_cast(val));
+ }
+ formatter.field("path", Lite(&_val.path));
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::ExprRange> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("ExprRange");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ if let Some(val) = &_val.from {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(Box<syn::Expr>);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ let _val = &self.0;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(_val), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ }
+ formatter.field("from", Print::ref_cast(val));
+ }
+ formatter.field("limits", Lite(&_val.limits));
+ if let Some(val) = &_val.to {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(Box<syn::Expr>);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ let _val = &self.0;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(_val), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ }
+ formatter.field("to", Print::ref_cast(val));
+ }
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::ExprReference> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("ExprReference");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ if let Some(val) = &_val.mutability {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Mut);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("mutability", Print::ref_cast(val));
+ }
+ formatter.field("expr", Lite(&_val.expr));
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::ExprRepeat> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("ExprRepeat");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("expr", Lite(&_val.expr));
+ formatter.field("len", Lite(&_val.len));
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::ExprReturn> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("ExprReturn");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ if let Some(val) = &_val.expr {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(Box<syn::Expr>);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ let _val = &self.0;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(_val), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ }
+ formatter.field("expr", Print::ref_cast(val));
+ }
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::ExprStruct> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("ExprStruct");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("path", Lite(&_val.path));
+ if !_val.fields.is_empty() {
+ formatter.field("fields", Lite(&_val.fields));
+ }
+ if let Some(val) = &_val.dot2_token {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Dot2);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("dot2_token", Print::ref_cast(val));
+ }
+ if let Some(val) = &_val.rest {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(Box<syn::Expr>);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ let _val = &self.0;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(_val), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ }
+ formatter.field("rest", Print::ref_cast(val));
+ }
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::ExprTry> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("ExprTry");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("expr", Lite(&_val.expr));
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::ExprTryBlock> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("ExprTryBlock");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("block", Lite(&_val.block));
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::ExprTuple> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("ExprTuple");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ if !_val.elems.is_empty() {
+ formatter.field("elems", Lite(&_val.elems));
+ }
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::ExprType> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("ExprType");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("expr", Lite(&_val.expr));
+ formatter.field("ty", Lite(&_val.ty));
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::ExprUnary> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("ExprUnary");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("op", Lite(&_val.op));
+ formatter.field("expr", Lite(&_val.expr));
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::ExprUnsafe> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("ExprUnsafe");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("block", Lite(&_val.block));
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::ExprVerbatim> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("ExprVerbatim");
+ formatter.field("tts", Lite(&_val.tts));
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::ExprWhile> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("ExprWhile");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ if let Some(val) = &_val.label {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::Label);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ let _val = &self.0;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(_val), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ }
+ formatter.field("label", Print::ref_cast(val));
+ }
+ formatter.field("cond", Lite(&_val.cond));
+ formatter.field("body", Lite(&_val.body));
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::ExprYield> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("ExprYield");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ if let Some(val) = &_val.expr {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(Box<syn::Expr>);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ let _val = &self.0;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(_val), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ }
+ formatter.field("expr", Print::ref_cast(val));
+ }
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::Field> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("Field");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("vis", Lite(&_val.vis));
+ if let Some(val) = &_val.ident {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(proc_macro2::Ident);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ let _val = &self.0;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(_val), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ }
+ formatter.field("ident", Print::ref_cast(val));
+ }
+ if let Some(val) = &_val.colon_token {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Colon);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("colon_token", Print::ref_cast(val));
+ }
+ formatter.field("ty", Lite(&_val.ty));
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::FieldPat> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("FieldPat");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("member", Lite(&_val.member));
+ if let Some(val) = &_val.colon_token {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Colon);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("colon_token", Print::ref_cast(val));
+ }
+ formatter.field("pat", Lite(&_val.pat));
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::FieldValue> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("FieldValue");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("member", Lite(&_val.member));
+ if let Some(val) = &_val.colon_token {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Colon);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("colon_token", Print::ref_cast(val));
+ }
+ formatter.field("expr", Lite(&_val.expr));
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::Fields> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ match _val {
+ syn::Fields::Named(_val) => {
+ let mut formatter = formatter.debug_struct("Fields::Named");
+ if !_val.named.is_empty() {
+ formatter.field("named", Lite(&_val.named));
+ }
+ formatter.finish()
+ }
+ syn::Fields::Unnamed(_val) => {
+ let mut formatter = formatter.debug_struct("Fields::Unnamed");
+ if !_val.unnamed.is_empty() {
+ formatter.field("unnamed", Lite(&_val.unnamed));
+ }
+ formatter.finish()
+ }
+ syn::Fields::Unit => formatter.write_str("Unit"),
+ }
+ }
+}
+impl Debug for Lite<syn::FieldsNamed> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("FieldsNamed");
+ if !_val.named.is_empty() {
+ formatter.field("named", Lite(&_val.named));
+ }
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::FieldsUnnamed> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("FieldsUnnamed");
+ if !_val.unnamed.is_empty() {
+ formatter.field("unnamed", Lite(&_val.unnamed));
+ }
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::File> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("File");
+ if let Some(val) = &_val.shebang {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(String);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ let _val = &self.0;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(_val), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ }
+ formatter.field("shebang", Print::ref_cast(val));
+ }
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ if !_val.items.is_empty() {
+ formatter.field("items", Lite(&_val.items));
+ }
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::FnArg> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ match _val {
+ syn::FnArg::SelfRef(_val) => {
+ formatter.write_str("SelfRef")?;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(_val), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ syn::FnArg::SelfValue(_val) => {
+ formatter.write_str("SelfValue")?;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(_val), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ syn::FnArg::Captured(_val) => {
+ formatter.write_str("Captured")?;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(_val), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ syn::FnArg::Inferred(_val) => {
+ formatter.write_str("Inferred")?;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(_val), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ syn::FnArg::Ignored(_val) => {
+ formatter.write_str("Ignored")?;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(_val), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ }
+ }
+}
+impl Debug for Lite<syn::FnDecl> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("FnDecl");
+ formatter.field("generics", Lite(&_val.generics));
+ if !_val.inputs.is_empty() {
+ formatter.field("inputs", Lite(&_val.inputs));
+ }
+ if let Some(val) = &_val.variadic {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Dot3);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("variadic", Print::ref_cast(val));
+ }
+ formatter.field("output", Lite(&_val.output));
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::ForeignItem> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ match _val {
+ syn::ForeignItem::Fn(_val) => {
+ let mut formatter = formatter.debug_struct("ForeignItem::Fn");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("vis", Lite(&_val.vis));
+ formatter.field("ident", Lite(&_val.ident));
+ formatter.field("decl", Lite(&_val.decl));
+ formatter.finish()
+ }
+ syn::ForeignItem::Static(_val) => {
+ let mut formatter = formatter.debug_struct("ForeignItem::Static");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("vis", Lite(&_val.vis));
+ if let Some(val) = &_val.mutability {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Mut);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("mutability", Print::ref_cast(val));
+ }
+ formatter.field("ident", Lite(&_val.ident));
+ formatter.field("ty", Lite(&_val.ty));
+ formatter.finish()
+ }
+ syn::ForeignItem::Type(_val) => {
+ let mut formatter = formatter.debug_struct("ForeignItem::Type");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("vis", Lite(&_val.vis));
+ formatter.field("ident", Lite(&_val.ident));
+ formatter.finish()
+ }
+ syn::ForeignItem::Macro(_val) => {
+ let mut formatter = formatter.debug_struct("ForeignItem::Macro");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("mac", Lite(&_val.mac));
+ if let Some(val) = &_val.semi_token {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Semi);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("semi_token", Print::ref_cast(val));
+ }
+ formatter.finish()
+ }
+ syn::ForeignItem::Verbatim(_val) => {
+ let mut formatter = formatter.debug_struct("ForeignItem::Verbatim");
+ formatter.field("tts", Lite(&_val.tts));
+ formatter.finish()
+ }
+ }
+ }
+}
+impl Debug for Lite<syn::ForeignItemFn> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("ForeignItemFn");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("vis", Lite(&_val.vis));
+ formatter.field("ident", Lite(&_val.ident));
+ formatter.field("decl", Lite(&_val.decl));
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::ForeignItemMacro> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("ForeignItemMacro");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("mac", Lite(&_val.mac));
+ if let Some(val) = &_val.semi_token {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Semi);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("semi_token", Print::ref_cast(val));
+ }
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::ForeignItemStatic> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("ForeignItemStatic");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("vis", Lite(&_val.vis));
+ if let Some(val) = &_val.mutability {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Mut);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("mutability", Print::ref_cast(val));
+ }
+ formatter.field("ident", Lite(&_val.ident));
+ formatter.field("ty", Lite(&_val.ty));
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::ForeignItemType> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("ForeignItemType");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("vis", Lite(&_val.vis));
+ formatter.field("ident", Lite(&_val.ident));
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::ForeignItemVerbatim> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("ForeignItemVerbatim");
+ formatter.field("tts", Lite(&_val.tts));
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::GenericArgument> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ match _val {
+ syn::GenericArgument::Lifetime(_val) => {
+ formatter.write_str("Lifetime")?;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(_val), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ syn::GenericArgument::Type(_val) => {
+ formatter.write_str("Type")?;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(_val), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ syn::GenericArgument::Binding(_val) => {
+ formatter.write_str("Binding")?;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(_val), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ syn::GenericArgument::Constraint(_val) => {
+ formatter.write_str("Constraint")?;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(_val), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ syn::GenericArgument::Const(_val) => {
+ formatter.write_str("Const")?;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(_val), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ }
+ }
+}
+impl Debug for Lite<syn::GenericMethodArgument> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ match _val {
+ syn::GenericMethodArgument::Type(_val) => {
+ formatter.write_str("Type")?;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(_val), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ syn::GenericMethodArgument::Const(_val) => {
+ formatter.write_str("Const")?;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(_val), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ }
+ }
+}
+impl Debug for Lite<syn::GenericParam> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ match _val {
+ syn::GenericParam::Type(_val) => {
+ formatter.write_str("Type")?;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(_val), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ syn::GenericParam::Lifetime(_val) => {
+ formatter.write_str("Lifetime")?;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(_val), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ syn::GenericParam::Const(_val) => {
+ formatter.write_str("Const")?;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(_val), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ }
+ }
+}
+impl Debug for Lite<syn::Generics> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("Generics");
+ if let Some(val) = &_val.lt_token {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Lt);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("lt_token", Print::ref_cast(val));
+ }
+ if !_val.params.is_empty() {
+ formatter.field("params", Lite(&_val.params));
+ }
+ if let Some(val) = &_val.gt_token {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Gt);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("gt_token", Print::ref_cast(val));
+ }
+ if let Some(val) = &_val.where_clause {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::WhereClause);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ let _val = &self.0;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(_val), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ }
+ formatter.field("where_clause", Print::ref_cast(val));
+ }
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::ImplItem> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ match _val {
+ syn::ImplItem::Const(_val) => {
+ let mut formatter = formatter.debug_struct("ImplItem::Const");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("vis", Lite(&_val.vis));
+ if let Some(val) = &_val.defaultness {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Default);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("defaultness", Print::ref_cast(val));
+ }
+ formatter.field("ident", Lite(&_val.ident));
+ formatter.field("ty", Lite(&_val.ty));
+ formatter.field("expr", Lite(&_val.expr));
+ formatter.finish()
+ }
+ syn::ImplItem::Method(_val) => {
+ let mut formatter = formatter.debug_struct("ImplItem::Method");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("vis", Lite(&_val.vis));
+ if let Some(val) = &_val.defaultness {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Default);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("defaultness", Print::ref_cast(val));
+ }
+ formatter.field("sig", Lite(&_val.sig));
+ formatter.field("block", Lite(&_val.block));
+ formatter.finish()
+ }
+ syn::ImplItem::Type(_val) => {
+ let mut formatter = formatter.debug_struct("ImplItem::Type");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("vis", Lite(&_val.vis));
+ if let Some(val) = &_val.defaultness {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Default);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("defaultness", Print::ref_cast(val));
+ }
+ formatter.field("ident", Lite(&_val.ident));
+ formatter.field("generics", Lite(&_val.generics));
+ formatter.field("ty", Lite(&_val.ty));
+ formatter.finish()
+ }
+ syn::ImplItem::Existential(_val) => {
+ let mut formatter = formatter.debug_struct("ImplItem::Existential");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("ident", Lite(&_val.ident));
+ formatter.field("generics", Lite(&_val.generics));
+ if let Some(val) = &_val.colon_token {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Colon);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("colon_token", Print::ref_cast(val));
+ }
+ if !_val.bounds.is_empty() {
+ formatter.field("bounds", Lite(&_val.bounds));
+ }
+ formatter.finish()
+ }
+ syn::ImplItem::Macro(_val) => {
+ let mut formatter = formatter.debug_struct("ImplItem::Macro");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("mac", Lite(&_val.mac));
+ if let Some(val) = &_val.semi_token {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Semi);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("semi_token", Print::ref_cast(val));
+ }
+ formatter.finish()
+ }
+ syn::ImplItem::Verbatim(_val) => {
+ let mut formatter = formatter.debug_struct("ImplItem::Verbatim");
+ formatter.field("tts", Lite(&_val.tts));
+ formatter.finish()
+ }
+ }
+ }
+}
+impl Debug for Lite<syn::ImplItemConst> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("ImplItemConst");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("vis", Lite(&_val.vis));
+ if let Some(val) = &_val.defaultness {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Default);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("defaultness", Print::ref_cast(val));
+ }
+ formatter.field("ident", Lite(&_val.ident));
+ formatter.field("ty", Lite(&_val.ty));
+ formatter.field("expr", Lite(&_val.expr));
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::ImplItemExistential> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("ImplItemExistential");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("ident", Lite(&_val.ident));
+ formatter.field("generics", Lite(&_val.generics));
+ if let Some(val) = &_val.colon_token {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Colon);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("colon_token", Print::ref_cast(val));
+ }
+ if !_val.bounds.is_empty() {
+ formatter.field("bounds", Lite(&_val.bounds));
+ }
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::ImplItemMacro> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("ImplItemMacro");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("mac", Lite(&_val.mac));
+ if let Some(val) = &_val.semi_token {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Semi);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("semi_token", Print::ref_cast(val));
+ }
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::ImplItemMethod> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("ImplItemMethod");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("vis", Lite(&_val.vis));
+ if let Some(val) = &_val.defaultness {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Default);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("defaultness", Print::ref_cast(val));
+ }
+ formatter.field("sig", Lite(&_val.sig));
+ formatter.field("block", Lite(&_val.block));
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::ImplItemType> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("ImplItemType");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("vis", Lite(&_val.vis));
+ if let Some(val) = &_val.defaultness {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Default);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("defaultness", Print::ref_cast(val));
+ }
+ formatter.field("ident", Lite(&_val.ident));
+ formatter.field("generics", Lite(&_val.generics));
+ formatter.field("ty", Lite(&_val.ty));
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::ImplItemVerbatim> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("ImplItemVerbatim");
+ formatter.field("tts", Lite(&_val.tts));
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::Index> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("Index");
+ formatter.field("index", Lite(&_val.index));
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::Item> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ match _val {
+ syn::Item::ExternCrate(_val) => {
+ let mut formatter = formatter.debug_struct("Item::ExternCrate");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("vis", Lite(&_val.vis));
+ formatter.field("ident", Lite(&_val.ident));
+ if let Some(val) = &_val.rename {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print((syn::token::As, proc_macro2::Ident));
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ let _val = &self.0;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(&_val.1), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ }
+ formatter.field("rename", Print::ref_cast(val));
+ }
+ formatter.finish()
+ }
+ syn::Item::Use(_val) => {
+ let mut formatter = formatter.debug_struct("Item::Use");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("vis", Lite(&_val.vis));
+ if let Some(val) = &_val.leading_colon {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Colon2);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("leading_colon", Print::ref_cast(val));
+ }
+ formatter.field("tree", Lite(&_val.tree));
+ formatter.finish()
+ }
+ syn::Item::Static(_val) => {
+ let mut formatter = formatter.debug_struct("Item::Static");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("vis", Lite(&_val.vis));
+ if let Some(val) = &_val.mutability {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Mut);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("mutability", Print::ref_cast(val));
+ }
+ formatter.field("ident", Lite(&_val.ident));
+ formatter.field("ty", Lite(&_val.ty));
+ formatter.field("expr", Lite(&_val.expr));
+ formatter.finish()
+ }
+ syn::Item::Const(_val) => {
+ let mut formatter = formatter.debug_struct("Item::Const");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("vis", Lite(&_val.vis));
+ formatter.field("ident", Lite(&_val.ident));
+ formatter.field("ty", Lite(&_val.ty));
+ formatter.field("expr", Lite(&_val.expr));
+ formatter.finish()
+ }
+ syn::Item::Fn(_val) => {
+ let mut formatter = formatter.debug_struct("Item::Fn");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("vis", Lite(&_val.vis));
+ if let Some(val) = &_val.constness {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Const);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("constness", Print::ref_cast(val));
+ }
+ if let Some(val) = &_val.unsafety {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Unsafe);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("unsafety", Print::ref_cast(val));
+ }
+ if let Some(val) = &_val.asyncness {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Async);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("asyncness", Print::ref_cast(val));
+ }
+ if let Some(val) = &_val.abi {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::Abi);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ let _val = &self.0;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(_val), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ }
+ formatter.field("abi", Print::ref_cast(val));
+ }
+ formatter.field("ident", Lite(&_val.ident));
+ formatter.field("decl", Lite(&_val.decl));
+ formatter.field("block", Lite(&_val.block));
+ formatter.finish()
+ }
+ syn::Item::Mod(_val) => {
+ let mut formatter = formatter.debug_struct("Item::Mod");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("vis", Lite(&_val.vis));
+ formatter.field("ident", Lite(&_val.ident));
+ if let Some(val) = &_val.content {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print((syn::token::Brace, Vec<syn::Item>));
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ let _val = &self.0;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(&_val.1), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ }
+ formatter.field("content", Print::ref_cast(val));
+ }
+ if let Some(val) = &_val.semi {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Semi);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("semi", Print::ref_cast(val));
+ }
+ formatter.finish()
+ }
+ syn::Item::ForeignMod(_val) => {
+ let mut formatter = formatter.debug_struct("Item::ForeignMod");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("abi", Lite(&_val.abi));
+ if !_val.items.is_empty() {
+ formatter.field("items", Lite(&_val.items));
+ }
+ formatter.finish()
+ }
+ syn::Item::Type(_val) => {
+ let mut formatter = formatter.debug_struct("Item::Type");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("vis", Lite(&_val.vis));
+ formatter.field("ident", Lite(&_val.ident));
+ formatter.field("generics", Lite(&_val.generics));
+ formatter.field("ty", Lite(&_val.ty));
+ formatter.finish()
+ }
+ syn::Item::Existential(_val) => {
+ let mut formatter = formatter.debug_struct("Item::Existential");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("vis", Lite(&_val.vis));
+ formatter.field("ident", Lite(&_val.ident));
+ formatter.field("generics", Lite(&_val.generics));
+ if let Some(val) = &_val.colon_token {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Colon);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("colon_token", Print::ref_cast(val));
+ }
+ if !_val.bounds.is_empty() {
+ formatter.field("bounds", Lite(&_val.bounds));
+ }
+ formatter.finish()
+ }
+ syn::Item::Struct(_val) => {
+ let mut formatter = formatter.debug_struct("Item::Struct");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("vis", Lite(&_val.vis));
+ formatter.field("ident", Lite(&_val.ident));
+ formatter.field("generics", Lite(&_val.generics));
+ formatter.field("fields", Lite(&_val.fields));
+ if let Some(val) = &_val.semi_token {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Semi);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("semi_token", Print::ref_cast(val));
+ }
+ formatter.finish()
+ }
+ syn::Item::Enum(_val) => {
+ let mut formatter = formatter.debug_struct("Item::Enum");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("vis", Lite(&_val.vis));
+ formatter.field("ident", Lite(&_val.ident));
+ formatter.field("generics", Lite(&_val.generics));
+ if !_val.variants.is_empty() {
+ formatter.field("variants", Lite(&_val.variants));
+ }
+ formatter.finish()
+ }
+ syn::Item::Union(_val) => {
+ let mut formatter = formatter.debug_struct("Item::Union");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("vis", Lite(&_val.vis));
+ formatter.field("ident", Lite(&_val.ident));
+ formatter.field("generics", Lite(&_val.generics));
+ formatter.field("fields", Lite(&_val.fields));
+ formatter.finish()
+ }
+ syn::Item::Trait(_val) => {
+ let mut formatter = formatter.debug_struct("Item::Trait");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("vis", Lite(&_val.vis));
+ if let Some(val) = &_val.unsafety {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Unsafe);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("unsafety", Print::ref_cast(val));
+ }
+ if let Some(val) = &_val.auto_token {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Auto);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("auto_token", Print::ref_cast(val));
+ }
+ formatter.field("ident", Lite(&_val.ident));
+ formatter.field("generics", Lite(&_val.generics));
+ if let Some(val) = &_val.colon_token {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Colon);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("colon_token", Print::ref_cast(val));
+ }
+ if !_val.supertraits.is_empty() {
+ formatter.field("supertraits", Lite(&_val.supertraits));
+ }
+ if !_val.items.is_empty() {
+ formatter.field("items", Lite(&_val.items));
+ }
+ formatter.finish()
+ }
+ syn::Item::TraitAlias(_val) => {
+ let mut formatter = formatter.debug_struct("Item::TraitAlias");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("vis", Lite(&_val.vis));
+ formatter.field("ident", Lite(&_val.ident));
+ formatter.field("generics", Lite(&_val.generics));
+ if !_val.bounds.is_empty() {
+ formatter.field("bounds", Lite(&_val.bounds));
+ }
+ formatter.finish()
+ }
+ syn::Item::Impl(_val) => {
+ let mut formatter = formatter.debug_struct("Item::Impl");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ if let Some(val) = &_val.defaultness {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Default);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("defaultness", Print::ref_cast(val));
+ }
+ if let Some(val) = &_val.unsafety {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Unsafe);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("unsafety", Print::ref_cast(val));
+ }
+ formatter.field("generics", Lite(&_val.generics));
+ if let Some(val) = &_val.trait_ {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print((Option<syn::token::Bang>, syn::Path, syn::token::For));
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ let _val = &self.0;
+ formatter.write_str("(")?;
+ Debug::fmt(
+ &(
+ {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(Option<syn::token::Bang>);
+ impl Debug for Print {
+ fn fmt(
+ &self,
+ formatter: &mut fmt::Formatter,
+ ) -> fmt::Result
+ {
+ match &self.0 {
+ Some(_val) => {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ None => formatter.write_str("None"),
+ }
+ }
+ }
+ Print::ref_cast(&_val.0)
+ },
+ Lite(&_val.1),
+ ),
+ formatter,
+ )?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ }
+ formatter.field("trait_", Print::ref_cast(val));
+ }
+ formatter.field("self_ty", Lite(&_val.self_ty));
+ if !_val.items.is_empty() {
+ formatter.field("items", Lite(&_val.items));
+ }
+ formatter.finish()
+ }
+ syn::Item::Macro(_val) => {
+ let mut formatter = formatter.debug_struct("Item::Macro");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ if let Some(val) = &_val.ident {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(proc_macro2::Ident);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ let _val = &self.0;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(_val), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ }
+ formatter.field("ident", Print::ref_cast(val));
+ }
+ formatter.field("mac", Lite(&_val.mac));
+ if let Some(val) = &_val.semi_token {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Semi);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("semi_token", Print::ref_cast(val));
+ }
+ formatter.finish()
+ }
+ syn::Item::Macro2(_val) => {
+ let mut formatter = formatter.debug_struct("Item::Macro2");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("vis", Lite(&_val.vis));
+ formatter.field("ident", Lite(&_val.ident));
+ formatter.field("args", Lite(&_val.args));
+ formatter.field("body", Lite(&_val.body));
+ formatter.finish()
+ }
+ syn::Item::Verbatim(_val) => {
+ let mut formatter = formatter.debug_struct("Item::Verbatim");
+ formatter.field("tts", Lite(&_val.tts));
+ formatter.finish()
+ }
+ }
+ }
+}
+impl Debug for Lite<syn::ItemConst> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("ItemConst");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("vis", Lite(&_val.vis));
+ formatter.field("ident", Lite(&_val.ident));
+ formatter.field("ty", Lite(&_val.ty));
+ formatter.field("expr", Lite(&_val.expr));
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::ItemEnum> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("ItemEnum");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("vis", Lite(&_val.vis));
+ formatter.field("ident", Lite(&_val.ident));
+ formatter.field("generics", Lite(&_val.generics));
+ if !_val.variants.is_empty() {
+ formatter.field("variants", Lite(&_val.variants));
+ }
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::ItemExistential> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("ItemExistential");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("vis", Lite(&_val.vis));
+ formatter.field("ident", Lite(&_val.ident));
+ formatter.field("generics", Lite(&_val.generics));
+ if let Some(val) = &_val.colon_token {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Colon);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("colon_token", Print::ref_cast(val));
+ }
+ if !_val.bounds.is_empty() {
+ formatter.field("bounds", Lite(&_val.bounds));
+ }
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::ItemExternCrate> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("ItemExternCrate");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("vis", Lite(&_val.vis));
+ formatter.field("ident", Lite(&_val.ident));
+ if let Some(val) = &_val.rename {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print((syn::token::As, proc_macro2::Ident));
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ let _val = &self.0;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(&_val.1), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ }
+ formatter.field("rename", Print::ref_cast(val));
+ }
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::ItemFn> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("ItemFn");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("vis", Lite(&_val.vis));
+ if let Some(val) = &_val.constness {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Const);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("constness", Print::ref_cast(val));
+ }
+ if let Some(val) = &_val.unsafety {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Unsafe);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("unsafety", Print::ref_cast(val));
+ }
+ if let Some(val) = &_val.asyncness {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Async);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("asyncness", Print::ref_cast(val));
+ }
+ if let Some(val) = &_val.abi {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::Abi);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ let _val = &self.0;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(_val), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ }
+ formatter.field("abi", Print::ref_cast(val));
+ }
+ formatter.field("ident", Lite(&_val.ident));
+ formatter.field("decl", Lite(&_val.decl));
+ formatter.field("block", Lite(&_val.block));
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::ItemForeignMod> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("ItemForeignMod");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("abi", Lite(&_val.abi));
+ if !_val.items.is_empty() {
+ formatter.field("items", Lite(&_val.items));
+ }
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::ItemImpl> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("ItemImpl");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ if let Some(val) = &_val.defaultness {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Default);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("defaultness", Print::ref_cast(val));
+ }
+ if let Some(val) = &_val.unsafety {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Unsafe);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("unsafety", Print::ref_cast(val));
+ }
+ formatter.field("generics", Lite(&_val.generics));
+ if let Some(val) = &_val.trait_ {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print((Option<syn::token::Bang>, syn::Path, syn::token::For));
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ let _val = &self.0;
+ formatter.write_str("(")?;
+ Debug::fmt(
+ &(
+ {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(Option<syn::token::Bang>);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ match &self.0 {
+ Some(_val) => {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ None => formatter.write_str("None"),
+ }
+ }
+ }
+ Print::ref_cast(&_val.0)
+ },
+ Lite(&_val.1),
+ ),
+ formatter,
+ )?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ }
+ formatter.field("trait_", Print::ref_cast(val));
+ }
+ formatter.field("self_ty", Lite(&_val.self_ty));
+ if !_val.items.is_empty() {
+ formatter.field("items", Lite(&_val.items));
+ }
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::ItemMacro> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("ItemMacro");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ if let Some(val) = &_val.ident {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(proc_macro2::Ident);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ let _val = &self.0;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(_val), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ }
+ formatter.field("ident", Print::ref_cast(val));
+ }
+ formatter.field("mac", Lite(&_val.mac));
+ if let Some(val) = &_val.semi_token {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Semi);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("semi_token", Print::ref_cast(val));
+ }
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::ItemMacro2> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("ItemMacro2");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("vis", Lite(&_val.vis));
+ formatter.field("ident", Lite(&_val.ident));
+ formatter.field("args", Lite(&_val.args));
+ formatter.field("body", Lite(&_val.body));
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::ItemMod> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("ItemMod");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("vis", Lite(&_val.vis));
+ formatter.field("ident", Lite(&_val.ident));
+ if let Some(val) = &_val.content {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print((syn::token::Brace, Vec<syn::Item>));
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ let _val = &self.0;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(&_val.1), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ }
+ formatter.field("content", Print::ref_cast(val));
+ }
+ if let Some(val) = &_val.semi {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Semi);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("semi", Print::ref_cast(val));
+ }
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::ItemStatic> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("ItemStatic");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("vis", Lite(&_val.vis));
+ if let Some(val) = &_val.mutability {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Mut);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("mutability", Print::ref_cast(val));
+ }
+ formatter.field("ident", Lite(&_val.ident));
+ formatter.field("ty", Lite(&_val.ty));
+ formatter.field("expr", Lite(&_val.expr));
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::ItemStruct> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("ItemStruct");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("vis", Lite(&_val.vis));
+ formatter.field("ident", Lite(&_val.ident));
+ formatter.field("generics", Lite(&_val.generics));
+ formatter.field("fields", Lite(&_val.fields));
+ if let Some(val) = &_val.semi_token {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Semi);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("semi_token", Print::ref_cast(val));
+ }
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::ItemTrait> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("ItemTrait");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("vis", Lite(&_val.vis));
+ if let Some(val) = &_val.unsafety {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Unsafe);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("unsafety", Print::ref_cast(val));
+ }
+ if let Some(val) = &_val.auto_token {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Auto);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("auto_token", Print::ref_cast(val));
+ }
+ formatter.field("ident", Lite(&_val.ident));
+ formatter.field("generics", Lite(&_val.generics));
+ if let Some(val) = &_val.colon_token {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Colon);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("colon_token", Print::ref_cast(val));
+ }
+ if !_val.supertraits.is_empty() {
+ formatter.field("supertraits", Lite(&_val.supertraits));
+ }
+ if !_val.items.is_empty() {
+ formatter.field("items", Lite(&_val.items));
+ }
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::ItemTraitAlias> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("ItemTraitAlias");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("vis", Lite(&_val.vis));
+ formatter.field("ident", Lite(&_val.ident));
+ formatter.field("generics", Lite(&_val.generics));
+ if !_val.bounds.is_empty() {
+ formatter.field("bounds", Lite(&_val.bounds));
+ }
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::ItemType> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("ItemType");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("vis", Lite(&_val.vis));
+ formatter.field("ident", Lite(&_val.ident));
+ formatter.field("generics", Lite(&_val.generics));
+ formatter.field("ty", Lite(&_val.ty));
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::ItemUnion> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("ItemUnion");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("vis", Lite(&_val.vis));
+ formatter.field("ident", Lite(&_val.ident));
+ formatter.field("generics", Lite(&_val.generics));
+ formatter.field("fields", Lite(&_val.fields));
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::ItemUse> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("ItemUse");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("vis", Lite(&_val.vis));
+ if let Some(val) = &_val.leading_colon {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Colon2);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("leading_colon", Print::ref_cast(val));
+ }
+ formatter.field("tree", Lite(&_val.tree));
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::ItemVerbatim> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("ItemVerbatim");
+ formatter.field("tts", Lite(&_val.tts));
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::Label> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("Label");
+ formatter.field("name", Lite(&_val.name));
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::Lifetime> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("Lifetime");
+ formatter.field("ident", Lite(&_val.ident));
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::LifetimeDef> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("LifetimeDef");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("lifetime", Lite(&_val.lifetime));
+ if let Some(val) = &_val.colon_token {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Colon);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("colon_token", Print::ref_cast(val));
+ }
+ if !_val.bounds.is_empty() {
+ formatter.field("bounds", Lite(&_val.bounds));
+ }
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::Lit> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ match _val {
+ syn::Lit::Str(_val) => write!(formatter, "{:?}", _val.value()),
+ syn::Lit::ByteStr(_val) => write!(formatter, "{:?}", _val.value()),
+ syn::Lit::Byte(_val) => write!(formatter, "{:?}", _val.value()),
+ syn::Lit::Char(_val) => write!(formatter, "{:?}", _val.value()),
+ syn::Lit::Int(_val) => write!(formatter, "{:?}", _val.value()),
+ syn::Lit::Float(_val) => write!(formatter, "{:?}", _val.value()),
+ syn::Lit::Bool(_val) => {
+ let mut formatter = formatter.debug_struct("Lit::Bool");
+ formatter.field("value", Lite(&_val.value));
+ formatter.finish()
+ }
+ syn::Lit::Verbatim(_val) => {
+ let mut formatter = formatter.debug_struct("Lit::Verbatim");
+ formatter.field("token", Lite(&_val.token));
+ formatter.finish()
+ }
+ }
+ }
+}
+impl Debug for Lite<syn::LitBool> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("LitBool");
+ formatter.field("value", Lite(&_val.value));
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::LitByte> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ write!(formatter, "{:?}", _val.value())
+ }
+}
+impl Debug for Lite<syn::LitByteStr> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ write!(formatter, "{:?}", _val.value())
+ }
+}
+impl Debug for Lite<syn::LitChar> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ write!(formatter, "{:?}", _val.value())
+ }
+}
+impl Debug for Lite<syn::LitFloat> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ write!(formatter, "{:?}", _val.value())
+ }
+}
+impl Debug for Lite<syn::LitInt> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ write!(formatter, "{:?}", _val.value())
+ }
+}
+impl Debug for Lite<syn::LitStr> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ write!(formatter, "{:?}", _val.value())
+ }
+}
+impl Debug for Lite<syn::LitVerbatim> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("LitVerbatim");
+ formatter.field("token", Lite(&_val.token));
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::Local> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("Local");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ if !_val.pats.is_empty() {
+ formatter.field("pats", Lite(&_val.pats));
+ }
+ if let Some(val) = &_val.ty {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print((syn::token::Colon, Box<syn::Type>));
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ let _val = &self.0;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(&_val.1), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ }
+ formatter.field("ty", Print::ref_cast(val));
+ }
+ if let Some(val) = &_val.init {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print((syn::token::Eq, Box<syn::Expr>));
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ let _val = &self.0;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(&_val.1), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ }
+ formatter.field("init", Print::ref_cast(val));
+ }
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::Macro> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("Macro");
+ formatter.field("path", Lite(&_val.path));
+ formatter.field("delimiter", Lite(&_val.delimiter));
+ formatter.field("tts", Lite(&_val.tts));
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::MacroDelimiter> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ match _val {
+ syn::MacroDelimiter::Paren(_val) => {
+ formatter.write_str("Paren")?;
+ Ok(())
+ }
+ syn::MacroDelimiter::Brace(_val) => {
+ formatter.write_str("Brace")?;
+ Ok(())
+ }
+ syn::MacroDelimiter::Bracket(_val) => {
+ formatter.write_str("Bracket")?;
+ Ok(())
+ }
+ }
+ }
+}
+impl Debug for Lite<syn::Member> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ match _val {
+ syn::Member::Named(_val) => {
+ formatter.write_str("Named")?;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(_val), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ syn::Member::Unnamed(_val) => {
+ formatter.write_str("Unnamed")?;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(_val), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ }
+ }
+}
+impl Debug for Lite<syn::Meta> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ match _val {
+ syn::Meta::Word(_val) => {
+ formatter.write_str("Word")?;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(_val), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ syn::Meta::List(_val) => {
+ let mut formatter = formatter.debug_struct("Meta::List");
+ formatter.field("ident", Lite(&_val.ident));
+ if !_val.nested.is_empty() {
+ formatter.field("nested", Lite(&_val.nested));
+ }
+ formatter.finish()
+ }
+ syn::Meta::NameValue(_val) => {
+ let mut formatter = formatter.debug_struct("Meta::NameValue");
+ formatter.field("ident", Lite(&_val.ident));
+ formatter.field("lit", Lite(&_val.lit));
+ formatter.finish()
+ }
+ }
+ }
+}
+impl Debug for Lite<syn::MetaList> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("MetaList");
+ formatter.field("ident", Lite(&_val.ident));
+ if !_val.nested.is_empty() {
+ formatter.field("nested", Lite(&_val.nested));
+ }
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::MetaNameValue> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("MetaNameValue");
+ formatter.field("ident", Lite(&_val.ident));
+ formatter.field("lit", Lite(&_val.lit));
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::MethodSig> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("MethodSig");
+ if let Some(val) = &_val.constness {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Const);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("constness", Print::ref_cast(val));
+ }
+ if let Some(val) = &_val.unsafety {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Unsafe);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("unsafety", Print::ref_cast(val));
+ }
+ if let Some(val) = &_val.asyncness {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Async);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("asyncness", Print::ref_cast(val));
+ }
+ if let Some(val) = &_val.abi {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::Abi);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ let _val = &self.0;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(_val), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ }
+ formatter.field("abi", Print::ref_cast(val));
+ }
+ formatter.field("ident", Lite(&_val.ident));
+ formatter.field("decl", Lite(&_val.decl));
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::MethodTurbofish> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("MethodTurbofish");
+ if !_val.args.is_empty() {
+ formatter.field("args", Lite(&_val.args));
+ }
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::NestedMeta> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ match _val {
+ syn::NestedMeta::Meta(_val) => {
+ formatter.write_str("Meta")?;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(_val), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ syn::NestedMeta::Literal(_val) => {
+ formatter.write_str("Literal")?;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(_val), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ }
+ }
+}
+impl Debug for Lite<syn::ParenthesizedGenericArguments> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("ParenthesizedGenericArguments");
+ if !_val.inputs.is_empty() {
+ formatter.field("inputs", Lite(&_val.inputs));
+ }
+ formatter.field("output", Lite(&_val.output));
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::Pat> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ match _val {
+ syn::Pat::Wild(_val) => {
+ let mut formatter = formatter.debug_struct("Pat::Wild");
+ formatter.finish()
+ }
+ syn::Pat::Ident(_val) => {
+ let mut formatter = formatter.debug_struct("Pat::Ident");
+ if let Some(val) = &_val.by_ref {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Ref);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("by_ref", Print::ref_cast(val));
+ }
+ if let Some(val) = &_val.mutability {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Mut);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("mutability", Print::ref_cast(val));
+ }
+ formatter.field("ident", Lite(&_val.ident));
+ if let Some(val) = &_val.subpat {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print((syn::token::At, Box<syn::Pat>));
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ let _val = &self.0;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(&_val.1), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ }
+ formatter.field("subpat", Print::ref_cast(val));
+ }
+ formatter.finish()
+ }
+ syn::Pat::Struct(_val) => {
+ let mut formatter = formatter.debug_struct("Pat::Struct");
+ formatter.field("path", Lite(&_val.path));
+ if !_val.fields.is_empty() {
+ formatter.field("fields", Lite(&_val.fields));
+ }
+ if let Some(val) = &_val.dot2_token {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Dot2);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("dot2_token", Print::ref_cast(val));
+ }
+ formatter.finish()
+ }
+ syn::Pat::TupleStruct(_val) => {
+ let mut formatter = formatter.debug_struct("Pat::TupleStruct");
+ formatter.field("path", Lite(&_val.path));
+ formatter.field("pat", Lite(&_val.pat));
+ formatter.finish()
+ }
+ syn::Pat::Path(_val) => {
+ let mut formatter = formatter.debug_struct("Pat::Path");
+ if let Some(val) = &_val.qself {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::QSelf);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ let _val = &self.0;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(_val), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ }
+ formatter.field("qself", Print::ref_cast(val));
+ }
+ formatter.field("path", Lite(&_val.path));
+ formatter.finish()
+ }
+ syn::Pat::Tuple(_val) => {
+ let mut formatter = formatter.debug_struct("Pat::Tuple");
+ if !_val.front.is_empty() {
+ formatter.field("front", Lite(&_val.front));
+ }
+ if let Some(val) = &_val.dot2_token {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Dot2);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("dot2_token", Print::ref_cast(val));
+ }
+ if let Some(val) = &_val.comma_token {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Comma);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("comma_token", Print::ref_cast(val));
+ }
+ if !_val.back.is_empty() {
+ formatter.field("back", Lite(&_val.back));
+ }
+ formatter.finish()
+ }
+ syn::Pat::Box(_val) => {
+ let mut formatter = formatter.debug_struct("Pat::Box");
+ formatter.field("pat", Lite(&_val.pat));
+ formatter.finish()
+ }
+ syn::Pat::Ref(_val) => {
+ let mut formatter = formatter.debug_struct("Pat::Ref");
+ if let Some(val) = &_val.mutability {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Mut);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("mutability", Print::ref_cast(val));
+ }
+ formatter.field("pat", Lite(&_val.pat));
+ formatter.finish()
+ }
+ syn::Pat::Lit(_val) => {
+ let mut formatter = formatter.debug_struct("Pat::Lit");
+ formatter.field("expr", Lite(&_val.expr));
+ formatter.finish()
+ }
+ syn::Pat::Range(_val) => {
+ let mut formatter = formatter.debug_struct("Pat::Range");
+ formatter.field("lo", Lite(&_val.lo));
+ formatter.field("limits", Lite(&_val.limits));
+ formatter.field("hi", Lite(&_val.hi));
+ formatter.finish()
+ }
+ syn::Pat::Slice(_val) => {
+ let mut formatter = formatter.debug_struct("Pat::Slice");
+ if !_val.front.is_empty() {
+ formatter.field("front", Lite(&_val.front));
+ }
+ if let Some(val) = &_val.middle {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(Box<syn::Pat>);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ let _val = &self.0;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(_val), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ }
+ formatter.field("middle", Print::ref_cast(val));
+ }
+ if let Some(val) = &_val.dot2_token {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Dot2);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("dot2_token", Print::ref_cast(val));
+ }
+ if let Some(val) = &_val.comma_token {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Comma);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("comma_token", Print::ref_cast(val));
+ }
+ if !_val.back.is_empty() {
+ formatter.field("back", Lite(&_val.back));
+ }
+ formatter.finish()
+ }
+ syn::Pat::Macro(_val) => {
+ let mut formatter = formatter.debug_struct("Pat::Macro");
+ formatter.field("mac", Lite(&_val.mac));
+ formatter.finish()
+ }
+ syn::Pat::Verbatim(_val) => {
+ let mut formatter = formatter.debug_struct("Pat::Verbatim");
+ formatter.field("tts", Lite(&_val.tts));
+ formatter.finish()
+ }
+ }
+ }
+}
+impl Debug for Lite<syn::PatBox> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("PatBox");
+ formatter.field("pat", Lite(&_val.pat));
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::PatIdent> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("PatIdent");
+ if let Some(val) = &_val.by_ref {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Ref);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("by_ref", Print::ref_cast(val));
+ }
+ if let Some(val) = &_val.mutability {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Mut);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("mutability", Print::ref_cast(val));
+ }
+ formatter.field("ident", Lite(&_val.ident));
+ if let Some(val) = &_val.subpat {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print((syn::token::At, Box<syn::Pat>));
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ let _val = &self.0;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(&_val.1), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ }
+ formatter.field("subpat", Print::ref_cast(val));
+ }
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::PatLit> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("PatLit");
+ formatter.field("expr", Lite(&_val.expr));
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::PatMacro> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("PatMacro");
+ formatter.field("mac", Lite(&_val.mac));
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::PatPath> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("PatPath");
+ if let Some(val) = &_val.qself {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::QSelf);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ let _val = &self.0;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(_val), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ }
+ formatter.field("qself", Print::ref_cast(val));
+ }
+ formatter.field("path", Lite(&_val.path));
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::PatRange> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("PatRange");
+ formatter.field("lo", Lite(&_val.lo));
+ formatter.field("limits", Lite(&_val.limits));
+ formatter.field("hi", Lite(&_val.hi));
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::PatRef> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("PatRef");
+ if let Some(val) = &_val.mutability {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Mut);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("mutability", Print::ref_cast(val));
+ }
+ formatter.field("pat", Lite(&_val.pat));
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::PatSlice> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("PatSlice");
+ if !_val.front.is_empty() {
+ formatter.field("front", Lite(&_val.front));
+ }
+ if let Some(val) = &_val.middle {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(Box<syn::Pat>);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ let _val = &self.0;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(_val), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ }
+ formatter.field("middle", Print::ref_cast(val));
+ }
+ if let Some(val) = &_val.dot2_token {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Dot2);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("dot2_token", Print::ref_cast(val));
+ }
+ if let Some(val) = &_val.comma_token {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Comma);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("comma_token", Print::ref_cast(val));
+ }
+ if !_val.back.is_empty() {
+ formatter.field("back", Lite(&_val.back));
+ }
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::PatStruct> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("PatStruct");
+ formatter.field("path", Lite(&_val.path));
+ if !_val.fields.is_empty() {
+ formatter.field("fields", Lite(&_val.fields));
+ }
+ if let Some(val) = &_val.dot2_token {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Dot2);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("dot2_token", Print::ref_cast(val));
+ }
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::PatTuple> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("PatTuple");
+ if !_val.front.is_empty() {
+ formatter.field("front", Lite(&_val.front));
+ }
+ if let Some(val) = &_val.dot2_token {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Dot2);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("dot2_token", Print::ref_cast(val));
+ }
+ if let Some(val) = &_val.comma_token {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Comma);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("comma_token", Print::ref_cast(val));
+ }
+ if !_val.back.is_empty() {
+ formatter.field("back", Lite(&_val.back));
+ }
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::PatTupleStruct> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("PatTupleStruct");
+ formatter.field("path", Lite(&_val.path));
+ formatter.field("pat", Lite(&_val.pat));
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::PatVerbatim> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("PatVerbatim");
+ formatter.field("tts", Lite(&_val.tts));
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::PatWild> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("PatWild");
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::Path> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("Path");
+ if let Some(val) = &_val.leading_colon {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Colon2);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("leading_colon", Print::ref_cast(val));
+ }
+ if !_val.segments.is_empty() {
+ formatter.field("segments", Lite(&_val.segments));
+ }
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::PathArguments> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ match _val {
+ syn::PathArguments::None => formatter.write_str("None"),
+ syn::PathArguments::AngleBracketed(_val) => {
+ let mut formatter = formatter.debug_struct("PathArguments::AngleBracketed");
+ if let Some(val) = &_val.colon2_token {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Colon2);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("colon2_token", Print::ref_cast(val));
+ }
+ if !_val.args.is_empty() {
+ formatter.field("args", Lite(&_val.args));
+ }
+ formatter.finish()
+ }
+ syn::PathArguments::Parenthesized(_val) => {
+ let mut formatter = formatter.debug_struct("PathArguments::Parenthesized");
+ if !_val.inputs.is_empty() {
+ formatter.field("inputs", Lite(&_val.inputs));
+ }
+ formatter.field("output", Lite(&_val.output));
+ formatter.finish()
+ }
+ }
+ }
+}
+impl Debug for Lite<syn::PathSegment> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("PathSegment");
+ formatter.field("ident", Lite(&_val.ident));
+ formatter.field("arguments", Lite(&_val.arguments));
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::PredicateEq> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("PredicateEq");
+ formatter.field("lhs_ty", Lite(&_val.lhs_ty));
+ formatter.field("rhs_ty", Lite(&_val.rhs_ty));
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::PredicateLifetime> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("PredicateLifetime");
+ formatter.field("lifetime", Lite(&_val.lifetime));
+ if !_val.bounds.is_empty() {
+ formatter.field("bounds", Lite(&_val.bounds));
+ }
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::PredicateType> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("PredicateType");
+ if let Some(val) = &_val.lifetimes {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::BoundLifetimes);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ let _val = &self.0;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(_val), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ }
+ formatter.field("lifetimes", Print::ref_cast(val));
+ }
+ formatter.field("bounded_ty", Lite(&_val.bounded_ty));
+ if !_val.bounds.is_empty() {
+ formatter.field("bounds", Lite(&_val.bounds));
+ }
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::QSelf> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("QSelf");
+ formatter.field("ty", Lite(&_val.ty));
+ formatter.field("position", Lite(&_val.position));
+ if let Some(val) = &_val.as_token {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::As);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("as_token", Print::ref_cast(val));
+ }
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::RangeLimits> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ match _val {
+ syn::RangeLimits::HalfOpen(_val) => {
+ formatter.write_str("HalfOpen")?;
+ Ok(())
+ }
+ syn::RangeLimits::Closed(_val) => {
+ formatter.write_str("Closed")?;
+ Ok(())
+ }
+ }
+ }
+}
+impl Debug for Lite<syn::ReturnType> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ match _val {
+ syn::ReturnType::Default => formatter.write_str("Default"),
+ syn::ReturnType::Type(_v0, _v1) => {
+ let mut formatter = formatter.debug_tuple("Type");
+ formatter.field(Lite(_v1));
+ formatter.finish()
+ }
+ }
+ }
+}
+impl Debug for Lite<syn::Stmt> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ match _val {
+ syn::Stmt::Local(_val) => {
+ formatter.write_str("Local")?;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(_val), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ syn::Stmt::Item(_val) => {
+ formatter.write_str("Item")?;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(_val), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ syn::Stmt::Expr(_val) => {
+ formatter.write_str("Expr")?;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(_val), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ syn::Stmt::Semi(_v0, _v1) => {
+ let mut formatter = formatter.debug_tuple("Semi");
+ formatter.field(Lite(_v0));
+ formatter.finish()
+ }
+ }
+ }
+}
+impl Debug for Lite<syn::TraitBound> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("TraitBound");
+ if let Some(val) = &_val.paren_token {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Paren);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("paren_token", Print::ref_cast(val));
+ }
+ formatter.field("modifier", Lite(&_val.modifier));
+ if let Some(val) = &_val.lifetimes {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::BoundLifetimes);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ let _val = &self.0;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(_val), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ }
+ formatter.field("lifetimes", Print::ref_cast(val));
+ }
+ formatter.field("path", Lite(&_val.path));
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::TraitBoundModifier> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ match _val {
+ syn::TraitBoundModifier::None => formatter.write_str("None"),
+ syn::TraitBoundModifier::Maybe(_val) => {
+ formatter.write_str("Maybe")?;
+ Ok(())
+ }
+ }
+ }
+}
+impl Debug for Lite<syn::TraitItem> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ match _val {
+ syn::TraitItem::Const(_val) => {
+ let mut formatter = formatter.debug_struct("TraitItem::Const");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("ident", Lite(&_val.ident));
+ formatter.field("ty", Lite(&_val.ty));
+ if let Some(val) = &_val.default {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print((syn::token::Eq, syn::Expr));
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ let _val = &self.0;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(&_val.1), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ }
+ formatter.field("default", Print::ref_cast(val));
+ }
+ formatter.finish()
+ }
+ syn::TraitItem::Method(_val) => {
+ let mut formatter = formatter.debug_struct("TraitItem::Method");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("sig", Lite(&_val.sig));
+ if let Some(val) = &_val.default {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::Block);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ let _val = &self.0;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(_val), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ }
+ formatter.field("default", Print::ref_cast(val));
+ }
+ if let Some(val) = &_val.semi_token {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Semi);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("semi_token", Print::ref_cast(val));
+ }
+ formatter.finish()
+ }
+ syn::TraitItem::Type(_val) => {
+ let mut formatter = formatter.debug_struct("TraitItem::Type");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("ident", Lite(&_val.ident));
+ formatter.field("generics", Lite(&_val.generics));
+ if let Some(val) = &_val.colon_token {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Colon);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("colon_token", Print::ref_cast(val));
+ }
+ if !_val.bounds.is_empty() {
+ formatter.field("bounds", Lite(&_val.bounds));
+ }
+ if let Some(val) = &_val.default {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print((syn::token::Eq, syn::Type));
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ let _val = &self.0;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(&_val.1), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ }
+ formatter.field("default", Print::ref_cast(val));
+ }
+ formatter.finish()
+ }
+ syn::TraitItem::Macro(_val) => {
+ let mut formatter = formatter.debug_struct("TraitItem::Macro");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("mac", Lite(&_val.mac));
+ if let Some(val) = &_val.semi_token {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Semi);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("semi_token", Print::ref_cast(val));
+ }
+ formatter.finish()
+ }
+ syn::TraitItem::Verbatim(_val) => {
+ let mut formatter = formatter.debug_struct("TraitItem::Verbatim");
+ formatter.field("tts", Lite(&_val.tts));
+ formatter.finish()
+ }
+ }
+ }
+}
+impl Debug for Lite<syn::TraitItemConst> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("TraitItemConst");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("ident", Lite(&_val.ident));
+ formatter.field("ty", Lite(&_val.ty));
+ if let Some(val) = &_val.default {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print((syn::token::Eq, syn::Expr));
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ let _val = &self.0;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(&_val.1), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ }
+ formatter.field("default", Print::ref_cast(val));
+ }
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::TraitItemMacro> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("TraitItemMacro");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("mac", Lite(&_val.mac));
+ if let Some(val) = &_val.semi_token {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Semi);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("semi_token", Print::ref_cast(val));
+ }
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::TraitItemMethod> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("TraitItemMethod");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("sig", Lite(&_val.sig));
+ if let Some(val) = &_val.default {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::Block);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ let _val = &self.0;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(_val), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ }
+ formatter.field("default", Print::ref_cast(val));
+ }
+ if let Some(val) = &_val.semi_token {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Semi);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("semi_token", Print::ref_cast(val));
+ }
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::TraitItemType> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("TraitItemType");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("ident", Lite(&_val.ident));
+ formatter.field("generics", Lite(&_val.generics));
+ if let Some(val) = &_val.colon_token {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Colon);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("colon_token", Print::ref_cast(val));
+ }
+ if !_val.bounds.is_empty() {
+ formatter.field("bounds", Lite(&_val.bounds));
+ }
+ if let Some(val) = &_val.default {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print((syn::token::Eq, syn::Type));
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ let _val = &self.0;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(&_val.1), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ }
+ formatter.field("default", Print::ref_cast(val));
+ }
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::TraitItemVerbatim> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("TraitItemVerbatim");
+ formatter.field("tts", Lite(&_val.tts));
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::Type> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ match _val {
+ syn::Type::Slice(_val) => {
+ let mut formatter = formatter.debug_struct("Type::Slice");
+ formatter.field("elem", Lite(&_val.elem));
+ formatter.finish()
+ }
+ syn::Type::Array(_val) => {
+ let mut formatter = formatter.debug_struct("Type::Array");
+ formatter.field("elem", Lite(&_val.elem));
+ formatter.field("len", Lite(&_val.len));
+ formatter.finish()
+ }
+ syn::Type::Ptr(_val) => {
+ let mut formatter = formatter.debug_struct("Type::Ptr");
+ if let Some(val) = &_val.const_token {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Const);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("const_token", Print::ref_cast(val));
+ }
+ if let Some(val) = &_val.mutability {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Mut);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("mutability", Print::ref_cast(val));
+ }
+ formatter.field("elem", Lite(&_val.elem));
+ formatter.finish()
+ }
+ syn::Type::Reference(_val) => {
+ let mut formatter = formatter.debug_struct("Type::Reference");
+ if let Some(val) = &_val.lifetime {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::Lifetime);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ let _val = &self.0;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(_val), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ }
+ formatter.field("lifetime", Print::ref_cast(val));
+ }
+ if let Some(val) = &_val.mutability {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Mut);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("mutability", Print::ref_cast(val));
+ }
+ formatter.field("elem", Lite(&_val.elem));
+ formatter.finish()
+ }
+ syn::Type::BareFn(_val) => {
+ let mut formatter = formatter.debug_struct("Type::BareFn");
+ if let Some(val) = &_val.lifetimes {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::BoundLifetimes);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ let _val = &self.0;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(_val), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ }
+ formatter.field("lifetimes", Print::ref_cast(val));
+ }
+ if let Some(val) = &_val.unsafety {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Unsafe);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("unsafety", Print::ref_cast(val));
+ }
+ if let Some(val) = &_val.abi {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::Abi);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ let _val = &self.0;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(_val), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ }
+ formatter.field("abi", Print::ref_cast(val));
+ }
+ if !_val.inputs.is_empty() {
+ formatter.field("inputs", Lite(&_val.inputs));
+ }
+ if let Some(val) = &_val.variadic {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Dot3);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("variadic", Print::ref_cast(val));
+ }
+ formatter.field("output", Lite(&_val.output));
+ formatter.finish()
+ }
+ syn::Type::Never(_val) => {
+ let mut formatter = formatter.debug_struct("Type::Never");
+ formatter.finish()
+ }
+ syn::Type::Tuple(_val) => {
+ let mut formatter = formatter.debug_struct("Type::Tuple");
+ if !_val.elems.is_empty() {
+ formatter.field("elems", Lite(&_val.elems));
+ }
+ formatter.finish()
+ }
+ syn::Type::Path(_val) => {
+ let mut formatter = formatter.debug_struct("Type::Path");
+ if let Some(val) = &_val.qself {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::QSelf);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ let _val = &self.0;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(_val), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ }
+ formatter.field("qself", Print::ref_cast(val));
+ }
+ formatter.field("path", Lite(&_val.path));
+ formatter.finish()
+ }
+ syn::Type::TraitObject(_val) => {
+ let mut formatter = formatter.debug_struct("Type::TraitObject");
+ if let Some(val) = &_val.dyn_token {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Dyn);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("dyn_token", Print::ref_cast(val));
+ }
+ if !_val.bounds.is_empty() {
+ formatter.field("bounds", Lite(&_val.bounds));
+ }
+ formatter.finish()
+ }
+ syn::Type::ImplTrait(_val) => {
+ let mut formatter = formatter.debug_struct("Type::ImplTrait");
+ if !_val.bounds.is_empty() {
+ formatter.field("bounds", Lite(&_val.bounds));
+ }
+ formatter.finish()
+ }
+ syn::Type::Paren(_val) => {
+ let mut formatter = formatter.debug_struct("Type::Paren");
+ formatter.field("elem", Lite(&_val.elem));
+ formatter.finish()
+ }
+ syn::Type::Group(_val) => {
+ let mut formatter = formatter.debug_struct("Type::Group");
+ formatter.field("elem", Lite(&_val.elem));
+ formatter.finish()
+ }
+ syn::Type::Infer(_val) => {
+ let mut formatter = formatter.debug_struct("Type::Infer");
+ formatter.finish()
+ }
+ syn::Type::Macro(_val) => {
+ let mut formatter = formatter.debug_struct("Type::Macro");
+ formatter.field("mac", Lite(&_val.mac));
+ formatter.finish()
+ }
+ syn::Type::Verbatim(_val) => {
+ let mut formatter = formatter.debug_struct("Type::Verbatim");
+ formatter.field("tts", Lite(&_val.tts));
+ formatter.finish()
+ }
+ }
+ }
+}
+impl Debug for Lite<syn::TypeArray> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("TypeArray");
+ formatter.field("elem", Lite(&_val.elem));
+ formatter.field("len", Lite(&_val.len));
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::TypeBareFn> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("TypeBareFn");
+ if let Some(val) = &_val.lifetimes {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::BoundLifetimes);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ let _val = &self.0;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(_val), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ }
+ formatter.field("lifetimes", Print::ref_cast(val));
+ }
+ if let Some(val) = &_val.unsafety {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Unsafe);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("unsafety", Print::ref_cast(val));
+ }
+ if let Some(val) = &_val.abi {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::Abi);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ let _val = &self.0;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(_val), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ }
+ formatter.field("abi", Print::ref_cast(val));
+ }
+ if !_val.inputs.is_empty() {
+ formatter.field("inputs", Lite(&_val.inputs));
+ }
+ if let Some(val) = &_val.variadic {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Dot3);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("variadic", Print::ref_cast(val));
+ }
+ formatter.field("output", Lite(&_val.output));
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::TypeGroup> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("TypeGroup");
+ formatter.field("elem", Lite(&_val.elem));
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::TypeImplTrait> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("TypeImplTrait");
+ if !_val.bounds.is_empty() {
+ formatter.field("bounds", Lite(&_val.bounds));
+ }
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::TypeInfer> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("TypeInfer");
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::TypeMacro> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("TypeMacro");
+ formatter.field("mac", Lite(&_val.mac));
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::TypeNever> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("TypeNever");
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::TypeParam> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("TypeParam");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("ident", Lite(&_val.ident));
+ if let Some(val) = &_val.colon_token {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Colon);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("colon_token", Print::ref_cast(val));
+ }
+ if !_val.bounds.is_empty() {
+ formatter.field("bounds", Lite(&_val.bounds));
+ }
+ if let Some(val) = &_val.eq_token {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Eq);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("eq_token", Print::ref_cast(val));
+ }
+ if let Some(val) = &_val.default {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::Type);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ let _val = &self.0;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(_val), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ }
+ formatter.field("default", Print::ref_cast(val));
+ }
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::TypeParamBound> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ match _val {
+ syn::TypeParamBound::Trait(_val) => {
+ formatter.write_str("Trait")?;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(_val), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ syn::TypeParamBound::Lifetime(_val) => {
+ formatter.write_str("Lifetime")?;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(_val), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ }
+ }
+}
+impl Debug for Lite<syn::TypeParen> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("TypeParen");
+ formatter.field("elem", Lite(&_val.elem));
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::TypePath> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("TypePath");
+ if let Some(val) = &_val.qself {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::QSelf);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ let _val = &self.0;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(_val), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ }
+ formatter.field("qself", Print::ref_cast(val));
+ }
+ formatter.field("path", Lite(&_val.path));
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::TypePtr> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("TypePtr");
+ if let Some(val) = &_val.const_token {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Const);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("const_token", Print::ref_cast(val));
+ }
+ if let Some(val) = &_val.mutability {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Mut);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("mutability", Print::ref_cast(val));
+ }
+ formatter.field("elem", Lite(&_val.elem));
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::TypeReference> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("TypeReference");
+ if let Some(val) = &_val.lifetime {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::Lifetime);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ let _val = &self.0;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(_val), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ }
+ formatter.field("lifetime", Print::ref_cast(val));
+ }
+ if let Some(val) = &_val.mutability {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Mut);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("mutability", Print::ref_cast(val));
+ }
+ formatter.field("elem", Lite(&_val.elem));
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::TypeSlice> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("TypeSlice");
+ formatter.field("elem", Lite(&_val.elem));
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::TypeTraitObject> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("TypeTraitObject");
+ if let Some(val) = &_val.dyn_token {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Dyn);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("dyn_token", Print::ref_cast(val));
+ }
+ if !_val.bounds.is_empty() {
+ formatter.field("bounds", Lite(&_val.bounds));
+ }
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::TypeTuple> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("TypeTuple");
+ if !_val.elems.is_empty() {
+ formatter.field("elems", Lite(&_val.elems));
+ }
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::TypeVerbatim> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("TypeVerbatim");
+ formatter.field("tts", Lite(&_val.tts));
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::UnOp> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ match _val {
+ syn::UnOp::Deref(_val) => {
+ formatter.write_str("Deref")?;
+ Ok(())
+ }
+ syn::UnOp::Not(_val) => {
+ formatter.write_str("Not")?;
+ Ok(())
+ }
+ syn::UnOp::Neg(_val) => {
+ formatter.write_str("Neg")?;
+ Ok(())
+ }
+ }
+ }
+}
+impl Debug for Lite<syn::UseGlob> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("UseGlob");
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::UseGroup> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("UseGroup");
+ if !_val.items.is_empty() {
+ formatter.field("items", Lite(&_val.items));
+ }
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::UseName> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("UseName");
+ formatter.field("ident", Lite(&_val.ident));
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::UsePath> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("UsePath");
+ formatter.field("ident", Lite(&_val.ident));
+ formatter.field("tree", Lite(&_val.tree));
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::UseRename> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("UseRename");
+ formatter.field("ident", Lite(&_val.ident));
+ formatter.field("rename", Lite(&_val.rename));
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::UseTree> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ match _val {
+ syn::UseTree::Path(_val) => {
+ formatter.write_str("Path")?;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(_val), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ syn::UseTree::Name(_val) => {
+ formatter.write_str("Name")?;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(_val), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ syn::UseTree::Rename(_val) => {
+ formatter.write_str("Rename")?;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(_val), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ syn::UseTree::Glob(_val) => {
+ formatter.write_str("Glob")?;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(_val), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ syn::UseTree::Group(_val) => {
+ formatter.write_str("Group")?;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(_val), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ }
+ }
+}
+impl Debug for Lite<syn::Variant> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("Variant");
+ if !_val.attrs.is_empty() {
+ formatter.field("attrs", Lite(&_val.attrs));
+ }
+ formatter.field("ident", Lite(&_val.ident));
+ formatter.field("fields", Lite(&_val.fields));
+ if let Some(val) = &_val.discriminant {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print((syn::token::Eq, syn::Expr));
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ let _val = &self.0;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(&_val.1), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ }
+ formatter.field("discriminant", Print::ref_cast(val));
+ }
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::VisCrate> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("VisCrate");
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::VisPublic> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("VisPublic");
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::VisRestricted> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("VisRestricted");
+ if let Some(val) = &_val.in_token {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::In);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("in_token", Print::ref_cast(val));
+ }
+ formatter.field("path", Lite(&_val.path));
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::Visibility> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ match _val {
+ syn::Visibility::Public(_val) => {
+ let mut formatter = formatter.debug_struct("Visibility::Public");
+ formatter.finish()
+ }
+ syn::Visibility::Crate(_val) => {
+ let mut formatter = formatter.debug_struct("Visibility::Crate");
+ formatter.finish()
+ }
+ syn::Visibility::Restricted(_val) => {
+ let mut formatter = formatter.debug_struct("Visibility::Restricted");
+ if let Some(val) = &_val.in_token {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::In);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("in_token", Print::ref_cast(val));
+ }
+ formatter.field("path", Lite(&_val.path));
+ formatter.finish()
+ }
+ syn::Visibility::Inherited => formatter.write_str("Inherited"),
+ }
+ }
+}
+impl Debug for Lite<syn::WhereClause> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ let mut formatter = formatter.debug_struct("WhereClause");
+ if !_val.predicates.is_empty() {
+ formatter.field("predicates", Lite(&_val.predicates));
+ }
+ formatter.finish()
+ }
+}
+impl Debug for Lite<syn::WherePredicate> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ let _val = &self.value;
+ match _val {
+ syn::WherePredicate::Type(_val) => {
+ formatter.write_str("Type")?;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(_val), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ syn::WherePredicate::Lifetime(_val) => {
+ formatter.write_str("Lifetime")?;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(_val), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ syn::WherePredicate::Eq(_val) => {
+ formatter.write_str("Eq")?;
+ formatter.write_str("(")?;
+ Debug::fmt(Lite(_val), formatter)?;
+ formatter.write_str(")")?;
+ Ok(())
+ }
+ }
+ }
+}
diff --git a/tests/debug/mod.rs b/tests/debug/mod.rs
new file mode 100644
index 0000000..c118053
--- /dev/null
+++ b/tests/debug/mod.rs
@@ -0,0 +1,113 @@
+extern crate proc_macro2;
+extern crate ref_cast;
+
+mod gen;
+
+use self::proc_macro2::{Ident, Literal, TokenStream};
+use self::ref_cast::RefCast;
+use std::fmt::{self, Debug};
+use std::ops::Deref;
+use syn::punctuated::Punctuated;
+
+#[derive(RefCast)]
+#[repr(transparent)]
+pub struct Lite<T: ?Sized> {
+ value: T,
+}
+
+#[allow(non_snake_case)]
+pub fn Lite<T: ?Sized>(value: &T) -> &Lite<T> {
+ Lite::ref_cast(value)
+}
+
+impl<T: ?Sized> Deref for Lite<T> {
+ type Target = T;
+
+ fn deref(&self) -> &Self::Target {
+ &self.value
+ }
+}
+
+impl Debug for Lite<bool> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ write!(formatter, "{}", self.value)
+ }
+}
+
+impl Debug for Lite<u32> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ write!(formatter, "{}", self.value)
+ }
+}
+
+impl Debug for Lite<usize> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ write!(formatter, "{}", self.value)
+ }
+}
+
+impl Debug for Lite<String> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ write!(formatter, "{:?}", self.value)
+ }
+}
+
+impl Debug for Lite<Ident> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ write!(formatter, "{:?}", self.value.to_string())
+ }
+}
+
+impl Debug for Lite<Literal> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ write!(formatter, "{}", self.value)
+ }
+}
+
+impl Debug for Lite<TokenStream> {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ write!(formatter, "`{}`", self.value)
+ }
+}
+
+impl<'a, T> Debug for Lite<&'a T>
+where
+ Lite<T>: Debug,
+{
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ Debug::fmt(Lite(&*self.value), formatter)
+ }
+}
+
+impl<T> Debug for Lite<Box<T>>
+where
+ Lite<T>: Debug,
+{
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ Debug::fmt(Lite(&*self.value), formatter)
+ }
+}
+
+impl<T> Debug for Lite<Vec<T>>
+where
+ Lite<T>: Debug,
+{
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter
+ .debug_list()
+ .entries(self.value.iter().map(Lite))
+ .finish()
+ }
+}
+
+impl<T, P> Debug for Lite<Punctuated<T, P>>
+where
+ Lite<T>: Debug,
+{
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter
+ .debug_list()
+ .entries(self.value.iter().map(Lite))
+ .finish()
+ }
+}
diff --git a/tests/macros/mod.rs b/tests/macros/mod.rs
index d53009b..e35872a 100644
--- a/tests/macros/mod.rs
+++ b/tests/macros/mod.rs
@@ -1,5 +1,8 @@
extern crate proc_macro2;
+#[path = "../debug/mod.rs"]
+pub mod debug;
+
use syn;
use syn::parse::{Parse, Result};
@@ -36,24 +39,21 @@
#[macro_export]
macro_rules! snapshot_impl {
- (($($expr:tt)*) as $t:ty) => {{
- let syntax_tree = ::macros::Tokens::parse::<$t>($($expr)*).unwrap();
- insta::assert_debug_snapshot_matches!(syntax_tree);
- syntax_tree
- }};
+ (($expr:ident) as $t:ty, @$snapshot:literal) => {
+ let $expr = ::macros::Tokens::parse::<$t>($expr).unwrap();
+ let debug = crate::macros::debug::Lite(&$expr);
+ insta::assert_debug_snapshot_matches!(debug, @$snapshot);
+ };
(($($expr:tt)*) as $t:ty, @$snapshot:literal) => {{
let syntax_tree = ::macros::Tokens::parse::<$t>($($expr)*).unwrap();
- insta::assert_debug_snapshot_matches!(syntax_tree, @$snapshot);
- syntax_tree
- }};
- (($($expr:tt)*)) => {{
- let syntax_tree = $($expr)*;
- insta::assert_debug_snapshot_matches!(syntax_tree);
+ let debug = crate::macros::debug::Lite(&syntax_tree);
+ insta::assert_debug_snapshot_matches!(debug, @$snapshot);
syntax_tree
}};
(($($expr:tt)*) , @$snapshot:literal) => {{
let syntax_tree = $($expr)*;
- insta::assert_debug_snapshot_matches!(syntax_tree, @$snapshot);
+ let debug = crate::macros::debug::Lite(&syntax_tree);
+ insta::assert_debug_snapshot_matches!(debug, @$snapshot);
syntax_tree
}};
(($($expr:tt)*) $next:tt $($rest:tt)*) => {
diff --git a/tests/snapshots/.gitignore b/tests/snapshots/.gitignore
deleted file mode 100644
index 25f2669..0000000
--- a/tests/snapshots/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-*.snap.new
diff --git a/tests/snapshots/test_asyncness__async_closure.snap b/tests/snapshots/test_asyncness__async_closure.snap
deleted file mode 100644
index 8c50031..0000000
--- a/tests/snapshots/test_asyncness__async_closure.snap
+++ /dev/null
@@ -1,30 +0,0 @@
----
-created: "2019-04-06T05:46:03.237747510Z"
-creator: insta@0.7.4
-source: tests/test_asyncness.rs
-expression: syntax_tree
----
-Closure(
- ExprClosure {
- attrs: [],
- asyncness: Some(
- Async,
- ),
- movability: None,
- capture: None,
- or1_token: Or,
- inputs: [],
- or2_token: Or,
- output: Default,
- body: Block(
- ExprBlock {
- attrs: [],
- label: None,
- block: Block {
- brace_token: Brace,
- stmts: [],
- },
- },
- ),
- },
-)
diff --git a/tests/snapshots/test_asyncness__async_fn.snap b/tests/snapshots/test_asyncness__async_fn.snap
deleted file mode 100644
index 968fa14..0000000
--- a/tests/snapshots/test_asyncness__async_fn.snap
+++ /dev/null
@@ -1,38 +0,0 @@
----
-created: "2019-04-06T05:46:03.237747494Z"
-creator: insta@0.7.4
-source: tests/test_asyncness.rs
-expression: syntax_tree
----
-Fn(
- ItemFn {
- attrs: [],
- vis: Inherited,
- constness: None,
- unsafety: None,
- asyncness: Some(
- Async,
- ),
- abi: None,
- ident: Ident(
- process,
- ),
- decl: FnDecl {
- fn_token: Fn,
- generics: Generics {
- lt_token: None,
- params: [],
- gt_token: None,
- where_clause: None,
- },
- paren_token: Paren,
- inputs: [],
- variadic: None,
- output: Default,
- },
- block: Block {
- brace_token: Brace,
- stmts: [],
- },
- },
-)
diff --git a/tests/snapshots/test_attribute__bool_lit-2.snap b/tests/snapshots/test_attribute__bool_lit-2.snap
deleted file mode 100644
index 5324c92..0000000
--- a/tests/snapshots/test_attribute__bool_lit-2.snap
+++ /dev/null
@@ -1,24 +0,0 @@
----
-created: "2019-04-06T05:46:03.273269313Z"
-creator: insta@0.7.4
-source: tests/test_attribute.rs
-expression: syntax_tree
----
-List(
- MetaList {
- ident: Ident(
- foo,
- ),
- paren_token: Paren,
- nested: [
- Literal(
- Bool(
- LitBool {
- value: true,
- span: Span,
- },
- ),
- ),
- ],
- },
-)
diff --git a/tests/snapshots/test_attribute__bool_lit.snap b/tests/snapshots/test_attribute__bool_lit.snap
deleted file mode 100644
index 9ff2d63..0000000
--- a/tests/snapshots/test_attribute__bool_lit.snap
+++ /dev/null
@@ -1,24 +0,0 @@
----
-created: "2019-04-06T05:46:03.255670528Z"
-creator: insta@0.7.4
-source: tests/test_attribute.rs
-expression: syntax_tree
----
-List(
- MetaList {
- ident: Ident(
- foo,
- ),
- paren_token: Paren,
- nested: [
- Literal(
- Bool(
- LitBool {
- value: true,
- span: Span,
- },
- ),
- ),
- ],
- },
-)
diff --git a/tests/snapshots/test_attribute__meta_item_bool_value-2.snap b/tests/snapshots/test_attribute__meta_item_bool_value-2.snap
deleted file mode 100644
index dd78b53..0000000
--- a/tests/snapshots/test_attribute__meta_item_bool_value-2.snap
+++ /dev/null
@@ -1,20 +0,0 @@
----
-created: "2019-04-06T05:46:03.265921142Z"
-creator: insta@0.7.4
-source: tests/test_attribute.rs
-expression: syntax_tree
----
-NameValue(
- MetaNameValue {
- ident: Ident(
- foo,
- ),
- eq_token: Eq,
- lit: Bool(
- LitBool {
- value: true,
- span: Span,
- },
- ),
- },
-)
diff --git a/tests/snapshots/test_attribute__meta_item_bool_value-3.snap b/tests/snapshots/test_attribute__meta_item_bool_value-3.snap
deleted file mode 100644
index 2fa7c3b..0000000
--- a/tests/snapshots/test_attribute__meta_item_bool_value-3.snap
+++ /dev/null
@@ -1,20 +0,0 @@
----
-created: "2019-04-06T05:46:03.280598224Z"
-creator: insta@0.7.4
-source: tests/test_attribute.rs
-expression: syntax_tree
----
-NameValue(
- MetaNameValue {
- ident: Ident(
- foo,
- ),
- eq_token: Eq,
- lit: Bool(
- LitBool {
- value: false,
- span: Span,
- },
- ),
- },
-)
diff --git a/tests/snapshots/test_attribute__meta_item_bool_value-4.snap b/tests/snapshots/test_attribute__meta_item_bool_value-4.snap
deleted file mode 100644
index 97650cf..0000000
--- a/tests/snapshots/test_attribute__meta_item_bool_value-4.snap
+++ /dev/null
@@ -1,20 +0,0 @@
----
-created: "2019-04-06T05:46:03.292095030Z"
-creator: insta@0.7.4
-source: tests/test_attribute.rs
-expression: syntax_tree
----
-NameValue(
- MetaNameValue {
- ident: Ident(
- foo,
- ),
- eq_token: Eq,
- lit: Bool(
- LitBool {
- value: false,
- span: Span,
- },
- ),
- },
-)
diff --git a/tests/snapshots/test_attribute__meta_item_bool_value.snap b/tests/snapshots/test_attribute__meta_item_bool_value.snap
deleted file mode 100644
index 1cd98f5..0000000
--- a/tests/snapshots/test_attribute__meta_item_bool_value.snap
+++ /dev/null
@@ -1,20 +0,0 @@
----
-created: "2019-04-06T05:46:03.255670526Z"
-creator: insta@0.7.4
-source: tests/test_attribute.rs
-expression: syntax_tree
----
-NameValue(
- MetaNameValue {
- ident: Ident(
- foo,
- ),
- eq_token: Eq,
- lit: Bool(
- LitBool {
- value: true,
- span: Span,
- },
- ),
- },
-)
diff --git a/tests/snapshots/test_attribute__meta_item_list_bool_value-2.snap b/tests/snapshots/test_attribute__meta_item_list_bool_value-2.snap
deleted file mode 100644
index c237f16..0000000
--- a/tests/snapshots/test_attribute__meta_item_list_bool_value-2.snap
+++ /dev/null
@@ -1,32 +0,0 @@
----
-created: "2019-04-06T05:46:03.266979099Z"
-creator: insta@0.7.4
-source: tests/test_attribute.rs
-expression: syntax_tree
----
-List(
- MetaList {
- ident: Ident(
- foo,
- ),
- paren_token: Paren,
- nested: [
- Meta(
- NameValue(
- MetaNameValue {
- ident: Ident(
- bar,
- ),
- eq_token: Eq,
- lit: Bool(
- LitBool {
- value: true,
- span: Span,
- },
- ),
- },
- ),
- ),
- ],
- },
-)
diff --git a/tests/snapshots/test_attribute__meta_item_list_bool_value.snap b/tests/snapshots/test_attribute__meta_item_list_bool_value.snap
deleted file mode 100644
index a50f80e..0000000
--- a/tests/snapshots/test_attribute__meta_item_list_bool_value.snap
+++ /dev/null
@@ -1,32 +0,0 @@
----
-created: "2019-04-06T05:46:03.255671860Z"
-creator: insta@0.7.4
-source: tests/test_attribute.rs
-expression: syntax_tree
----
-List(
- MetaList {
- ident: Ident(
- foo,
- ),
- paren_token: Paren,
- nested: [
- Meta(
- NameValue(
- MetaNameValue {
- ident: Ident(
- bar,
- ),
- eq_token: Eq,
- lit: Bool(
- LitBool {
- value: true,
- span: Span,
- },
- ),
- },
- ),
- ),
- ],
- },
-)
diff --git a/tests/snapshots/test_attribute__meta_item_list_lit-2.snap b/tests/snapshots/test_attribute__meta_item_list_lit-2.snap
deleted file mode 100644
index 81d7b0d..0000000
--- a/tests/snapshots/test_attribute__meta_item_list_lit-2.snap
+++ /dev/null
@@ -1,25 +0,0 @@
----
-created: "2019-04-06T05:46:03.268856961Z"
-creator: insta@0.7.4
-source: tests/test_attribute.rs
-expression: syntax_tree
----
-List(
- MetaList {
- ident: Ident(
- foo,
- ),
- paren_token: Paren,
- nested: [
- Literal(
- Int(
- LitInt {
- token: Literal {
- lit: 5,
- },
- },
- ),
- ),
- ],
- },
-)
diff --git a/tests/snapshots/test_attribute__meta_item_list_lit.snap b/tests/snapshots/test_attribute__meta_item_list_lit.snap
deleted file mode 100644
index 146e9ce..0000000
--- a/tests/snapshots/test_attribute__meta_item_list_lit.snap
+++ /dev/null
@@ -1,25 +0,0 @@
----
-created: "2019-04-06T05:46:03.255671858Z"
-creator: insta@0.7.4
-source: tests/test_attribute.rs
-expression: syntax_tree
----
-List(
- MetaList {
- ident: Ident(
- foo,
- ),
- paren_token: Paren,
- nested: [
- Literal(
- Int(
- LitInt {
- token: Literal {
- lit: 5,
- },
- },
- ),
- ),
- ],
- },
-)
diff --git a/tests/snapshots/test_attribute__meta_item_list_name_value-2.snap b/tests/snapshots/test_attribute__meta_item_list_name_value-2.snap
deleted file mode 100644
index dd35fdc..0000000
--- a/tests/snapshots/test_attribute__meta_item_list_name_value-2.snap
+++ /dev/null
@@ -1,33 +0,0 @@
----
-created: "2019-04-06T05:46:03.289949818Z"
-creator: insta@0.7.4
-source: tests/test_attribute.rs
-expression: syntax_tree
----
-List(
- MetaList {
- ident: Ident(
- foo,
- ),
- paren_token: Paren,
- nested: [
- Meta(
- NameValue(
- MetaNameValue {
- ident: Ident(
- bar,
- ),
- eq_token: Eq,
- lit: Int(
- LitInt {
- token: Literal {
- lit: 5,
- },
- },
- ),
- },
- ),
- ),
- ],
- },
-)
diff --git a/tests/snapshots/test_attribute__meta_item_list_name_value.snap b/tests/snapshots/test_attribute__meta_item_list_name_value.snap
deleted file mode 100644
index 1c2475b..0000000
--- a/tests/snapshots/test_attribute__meta_item_list_name_value.snap
+++ /dev/null
@@ -1,33 +0,0 @@
----
-created: "2019-04-06T05:46:03.279992979Z"
-creator: insta@0.7.4
-source: tests/test_attribute.rs
-expression: syntax_tree
----
-List(
- MetaList {
- ident: Ident(
- foo,
- ),
- paren_token: Paren,
- nested: [
- Meta(
- NameValue(
- MetaNameValue {
- ident: Ident(
- bar,
- ),
- eq_token: Eq,
- lit: Int(
- LitInt {
- token: Literal {
- lit: 5,
- },
- },
- ),
- },
- ),
- ),
- ],
- },
-)
diff --git a/tests/snapshots/test_attribute__meta_item_list_word-2.snap b/tests/snapshots/test_attribute__meta_item_list_word-2.snap
deleted file mode 100644
index 8b2fdd9..0000000
--- a/tests/snapshots/test_attribute__meta_item_list_word-2.snap
+++ /dev/null
@@ -1,23 +0,0 @@
----
-created: "2019-04-06T05:46:03.291107448Z"
-creator: insta@0.7.4
-source: tests/test_attribute.rs
-expression: syntax_tree
----
-List(
- MetaList {
- ident: Ident(
- foo,
- ),
- paren_token: Paren,
- nested: [
- Meta(
- Word(
- Ident(
- bar,
- ),
- ),
- ),
- ],
- },
-)
diff --git a/tests/snapshots/test_attribute__meta_item_list_word.snap b/tests/snapshots/test_attribute__meta_item_list_word.snap
deleted file mode 100644
index a6325f1..0000000
--- a/tests/snapshots/test_attribute__meta_item_list_word.snap
+++ /dev/null
@@ -1,23 +0,0 @@
----
-created: "2019-04-06T05:46:03.281142396Z"
-creator: insta@0.7.4
-source: tests/test_attribute.rs
-expression: syntax_tree
----
-List(
- MetaList {
- ident: Ident(
- foo,
- ),
- paren_token: Paren,
- nested: [
- Meta(
- Word(
- Ident(
- bar,
- ),
- ),
- ),
- ],
- },
-)
diff --git a/tests/snapshots/test_attribute__meta_item_multiple-2.snap b/tests/snapshots/test_attribute__meta_item_multiple-2.snap
deleted file mode 100644
index e04143e..0000000
--- a/tests/snapshots/test_attribute__meta_item_multiple-2.snap
+++ /dev/null
@@ -1,79 +0,0 @@
----
-created: "2019-04-06T05:46:03.299496452Z"
-creator: insta@0.7.4
-source: tests/test_attribute.rs
-expression: syntax_tree
----
-List(
- MetaList {
- ident: Ident(
- foo,
- ),
- paren_token: Paren,
- nested: [
- Meta(
- Word(
- Ident(
- word,
- ),
- ),
- ),
- Comma,
- Meta(
- NameValue(
- MetaNameValue {
- ident: Ident(
- name,
- ),
- eq_token: Eq,
- lit: Int(
- LitInt {
- token: Literal {
- lit: 5,
- },
- },
- ),
- },
- ),
- ),
- Comma,
- Meta(
- List(
- MetaList {
- ident: Ident(
- list,
- ),
- paren_token: Paren,
- nested: [
- Meta(
- NameValue(
- MetaNameValue {
- ident: Ident(
- name2,
- ),
- eq_token: Eq,
- lit: Int(
- LitInt {
- token: Literal {
- lit: 6,
- },
- },
- ),
- },
- ),
- ),
- ],
- },
- ),
- ),
- Comma,
- Meta(
- Word(
- Ident(
- word2,
- ),
- ),
- ),
- ],
- },
-)
diff --git a/tests/snapshots/test_attribute__meta_item_multiple.snap b/tests/snapshots/test_attribute__meta_item_multiple.snap
deleted file mode 100644
index 6aeb2a9..0000000
--- a/tests/snapshots/test_attribute__meta_item_multiple.snap
+++ /dev/null
@@ -1,79 +0,0 @@
----
-created: "2019-04-06T05:46:03.287814363Z"
-creator: insta@0.7.4
-source: tests/test_attribute.rs
-expression: syntax_tree
----
-List(
- MetaList {
- ident: Ident(
- foo,
- ),
- paren_token: Paren,
- nested: [
- Meta(
- Word(
- Ident(
- word,
- ),
- ),
- ),
- Comma,
- Meta(
- NameValue(
- MetaNameValue {
- ident: Ident(
- name,
- ),
- eq_token: Eq,
- lit: Int(
- LitInt {
- token: Literal {
- lit: 5,
- },
- },
- ),
- },
- ),
- ),
- Comma,
- Meta(
- List(
- MetaList {
- ident: Ident(
- list,
- ),
- paren_token: Paren,
- nested: [
- Meta(
- NameValue(
- MetaNameValue {
- ident: Ident(
- name2,
- ),
- eq_token: Eq,
- lit: Int(
- LitInt {
- token: Literal {
- lit: 6,
- },
- },
- ),
- },
- ),
- ),
- ],
- },
- ),
- ),
- Comma,
- Meta(
- Word(
- Ident(
- word2,
- ),
- ),
- ),
- ],
- },
-)
diff --git a/tests/snapshots/test_attribute__meta_item_name_value-2.snap b/tests/snapshots/test_attribute__meta_item_name_value-2.snap
deleted file mode 100644
index 8842935..0000000
--- a/tests/snapshots/test_attribute__meta_item_name_value-2.snap
+++ /dev/null
@@ -1,21 +0,0 @@
----
-created: "2019-04-06T05:46:03.311318597Z"
-creator: insta@0.7.4
-source: tests/test_attribute.rs
-expression: syntax_tree
----
-NameValue(
- MetaNameValue {
- ident: Ident(
- foo,
- ),
- eq_token: Eq,
- lit: Int(
- LitInt {
- token: Literal {
- lit: 5,
- },
- },
- ),
- },
-)
diff --git a/tests/snapshots/test_attribute__meta_item_name_value.snap b/tests/snapshots/test_attribute__meta_item_name_value.snap
deleted file mode 100644
index 7d7c44a..0000000
--- a/tests/snapshots/test_attribute__meta_item_name_value.snap
+++ /dev/null
@@ -1,21 +0,0 @@
----
-created: "2019-04-06T05:46:03.299637357Z"
-creator: insta@0.7.4
-source: tests/test_attribute.rs
-expression: syntax_tree
----
-NameValue(
- MetaNameValue {
- ident: Ident(
- foo,
- ),
- eq_token: Eq,
- lit: Int(
- LitInt {
- token: Literal {
- lit: 5,
- },
- },
- ),
- },
-)
diff --git a/tests/snapshots/test_attribute__meta_item_word-2.snap b/tests/snapshots/test_attribute__meta_item_word-2.snap
deleted file mode 100644
index 3bce0b0..0000000
--- a/tests/snapshots/test_attribute__meta_item_word-2.snap
+++ /dev/null
@@ -1,11 +0,0 @@
----
-created: "2019-04-06T05:46:03.313954162Z"
-creator: insta@0.7.4
-source: tests/test_attribute.rs
-expression: syntax_tree
----
-Word(
- Ident(
- foo,
- ),
-)
diff --git a/tests/snapshots/test_attribute__meta_item_word.snap b/tests/snapshots/test_attribute__meta_item_word.snap
deleted file mode 100644
index 5cd7c28..0000000
--- a/tests/snapshots/test_attribute__meta_item_word.snap
+++ /dev/null
@@ -1,11 +0,0 @@
----
-created: "2019-04-06T05:46:03.302739380Z"
-creator: insta@0.7.4
-source: tests/test_attribute.rs
-expression: syntax_tree
----
-Word(
- Ident(
- foo,
- ),
-)
diff --git a/tests/snapshots/test_derive_input__ambiguous_crate.snap b/tests/snapshots/test_derive_input__ambiguous_crate.snap
deleted file mode 100644
index 2a42115..0000000
--- a/tests/snapshots/test_derive_input__ambiguous_crate.snap
+++ /dev/null
@@ -1,63 +0,0 @@
----
-created: "2019-04-06T05:46:03.331610977Z"
-creator: insta@0.7.4
-source: tests/test_derive_input.rs
-expression: syntax_tree
----
-DeriveInput {
- attrs: [],
- vis: Inherited,
- ident: Ident(
- S,
- ),
- generics: Generics {
- lt_token: None,
- params: [],
- gt_token: None,
- where_clause: None,
- },
- data: Struct(
- DataStruct {
- struct_token: Struct,
- fields: Unnamed(
- FieldsUnnamed {
- paren_token: Paren,
- unnamed: [
- Field {
- attrs: [],
- vis: Inherited,
- ident: None,
- colon_token: None,
- ty: Path(
- TypePath {
- qself: None,
- path: Path {
- leading_colon: None,
- segments: [
- PathSegment {
- ident: Ident(
- crate,
- ),
- arguments: None,
- },
- Colon2,
- PathSegment {
- ident: Ident(
- X,
- ),
- arguments: None,
- },
- ],
- },
- },
- ),
- },
- ],
- },
- ),
- semi_token: Some(
- Semi,
- ),
- },
- ),
-}
diff --git a/tests/snapshots/test_derive_input__attr_with_mod_style_path_with_self.snap b/tests/snapshots/test_derive_input__attr_with_mod_style_path_with_self.snap
deleted file mode 100644
index f80cf0f..0000000
--- a/tests/snapshots/test_derive_input__attr_with_mod_style_path_with_self.snap
+++ /dev/null
@@ -1,53 +0,0 @@
----
-created: "2019-04-06T05:46:03.331559308Z"
-creator: insta@0.7.4
-source: tests/test_derive_input.rs
-expression: syntax_tree
----
-DeriveInput {
- attrs: [
- Attribute {
- pound_token: Pound,
- style: Outer,
- bracket_token: Bracket,
- path: Path {
- leading_colon: None,
- segments: [
- PathSegment {
- ident: Ident(
- foo,
- ),
- arguments: None,
- },
- Colon2,
- PathSegment {
- ident: Ident(
- self,
- ),
- arguments: None,
- },
- ],
- },
- tts: TokenStream [],
- },
- ],
- vis: Inherited,
- ident: Ident(
- S,
- ),
- generics: Generics {
- lt_token: None,
- params: [],
- gt_token: None,
- where_clause: None,
- },
- data: Struct(
- DataStruct {
- struct_token: Struct,
- fields: Unit,
- semi_token: Some(
- Semi,
- ),
- },
- ),
-}
diff --git a/tests/snapshots/test_derive_input__attr_with_non_mod_style_path.snap b/tests/snapshots/test_derive_input__attr_with_non_mod_style_path.snap
deleted file mode 100644
index 2e55bc5..0000000
--- a/tests/snapshots/test_derive_input__attr_with_non_mod_style_path.snap
+++ /dev/null
@@ -1,58 +0,0 @@
----
-created: "2019-04-06T05:46:03.331559297Z"
-creator: insta@0.7.4
-source: tests/test_derive_input.rs
-expression: syntax_tree
----
-DeriveInput {
- attrs: [
- Attribute {
- pound_token: Pound,
- style: Outer,
- bracket_token: Bracket,
- path: Path {
- leading_colon: None,
- segments: [
- PathSegment {
- ident: Ident(
- inert,
- ),
- arguments: None,
- },
- ],
- },
- tts: TokenStream [
- Punct {
- op: '<',
- spacing: Alone,
- },
- Ident {
- sym: T,
- },
- Punct {
- op: '>',
- spacing: Alone,
- },
- ],
- },
- ],
- vis: Inherited,
- ident: Ident(
- S,
- ),
- generics: Generics {
- lt_token: None,
- params: [],
- gt_token: None,
- where_clause: None,
- },
- data: Struct(
- DataStruct {
- struct_token: Struct,
- fields: Unit,
- semi_token: Some(
- Semi,
- ),
- },
- ),
-}
diff --git a/tests/snapshots/test_derive_input__attr_with_path.snap b/tests/snapshots/test_derive_input__attr_with_path.snap
deleted file mode 100644
index bd3d78e..0000000
--- a/tests/snapshots/test_derive_input__attr_with_path.snap
+++ /dev/null
@@ -1,101 +0,0 @@
----
-created: "2019-04-06T05:46:03.331570044Z"
-creator: insta@0.7.4
-source: tests/test_derive_input.rs
-expression: syntax_tree
----
-DeriveInput {
- attrs: [
- Attribute {
- pound_token: Pound,
- style: Outer,
- bracket_token: Bracket,
- path: Path {
- leading_colon: Some(
- Colon2,
- ),
- segments: [
- PathSegment {
- ident: Ident(
- attr_args,
- ),
- arguments: None,
- },
- Colon2,
- PathSegment {
- ident: Ident(
- identity,
- ),
- arguments: None,
- },
- ],
- },
- tts: TokenStream [
- Ident {
- sym: fn,
- },
- Ident {
- sym: main,
- },
- Group {
- delimiter: Parenthesis,
- stream: TokenStream [],
- },
- Group {
- delimiter: Brace,
- stream: TokenStream [
- Ident {
- sym: assert_eq,
- },
- Punct {
- op: '!',
- spacing: Alone,
- },
- Group {
- delimiter: Parenthesis,
- stream: TokenStream [
- Ident {
- sym: foo,
- },
- Group {
- delimiter: Parenthesis,
- stream: TokenStream [],
- },
- Punct {
- op: ',',
- spacing: Alone,
- },
- Literal {
- lit: "Hello, world!",
- },
- ],
- },
- Punct {
- op: ';',
- spacing: Alone,
- },
- ],
- },
- ],
- },
- ],
- vis: Inherited,
- ident: Ident(
- Dummy,
- ),
- generics: Generics {
- lt_token: None,
- params: [],
- gt_token: None,
- where_clause: None,
- },
- data: Struct(
- DataStruct {
- struct_token: Struct,
- fields: Unit,
- semi_token: Some(
- Semi,
- ),
- },
- ),
-}
diff --git a/tests/snapshots/test_derive_input__enum-2.snap b/tests/snapshots/test_derive_input__enum-2.snap
deleted file mode 100644
index f6a84b3..0000000
--- a/tests/snapshots/test_derive_input__enum-2.snap
+++ /dev/null
@@ -1,28 +0,0 @@
----
-created: "2019-04-06T05:46:03.356798327Z"
-creator: insta@0.7.4
-source: tests/test_derive_input.rs
-expression: syntax_tree
----
-[
- NameValue(
- MetaNameValue {
- ident: Ident(
- doc,
- ),
- eq_token: Eq,
- lit: Str(
- LitStr {
- token: Literal {
- lit: r" See the std::result module documentation for details.",
- },
- },
- ),
- },
- ),
- Word(
- Ident(
- must_use,
- ),
- ),
-]
diff --git a/tests/snapshots/test_derive_input__enum.snap b/tests/snapshots/test_derive_input__enum.snap
deleted file mode 100644
index 5e00d01..0000000
--- a/tests/snapshots/test_derive_input__enum.snap
+++ /dev/null
@@ -1,260 +0,0 @@
----
-created: "2019-04-06T05:46:03.344659106Z"
-creator: insta@0.7.4
-source: tests/test_derive_input.rs
-expression: syntax_tree
----
-DeriveInput {
- attrs: [
- Attribute {
- pound_token: Pound,
- style: Outer,
- bracket_token: Bracket,
- path: Path {
- leading_colon: None,
- segments: [
- PathSegment {
- ident: Ident(
- doc,
- ),
- arguments: None,
- },
- ],
- },
- tts: TokenStream [
- Punct {
- op: '=',
- spacing: Alone,
- },
- Literal {
- lit: r" See the std::result module documentation for details.",
- },
- ],
- },
- Attribute {
- pound_token: Pound,
- style: Outer,
- bracket_token: Bracket,
- path: Path {
- leading_colon: None,
- segments: [
- PathSegment {
- ident: Ident(
- must_use,
- ),
- arguments: None,
- },
- ],
- },
- tts: TokenStream [],
- },
- ],
- vis: Public(
- VisPublic {
- pub_token: Pub,
- },
- ),
- ident: Ident(
- Result,
- ),
- generics: Generics {
- lt_token: Some(
- Lt,
- ),
- params: [
- Type(
- TypeParam {
- attrs: [],
- ident: Ident(
- T,
- ),
- colon_token: None,
- bounds: [],
- eq_token: None,
- default: None,
- },
- ),
- Comma,
- Type(
- TypeParam {
- attrs: [],
- ident: Ident(
- E,
- ),
- colon_token: None,
- bounds: [],
- eq_token: None,
- default: None,
- },
- ),
- ],
- gt_token: Some(
- Gt,
- ),
- where_clause: None,
- },
- data: Enum(
- DataEnum {
- enum_token: Enum,
- brace_token: Brace,
- variants: [
- Variant {
- attrs: [],
- ident: Ident(
- Ok,
- ),
- fields: Unnamed(
- FieldsUnnamed {
- paren_token: Paren,
- unnamed: [
- Field {
- attrs: [],
- vis: Inherited,
- ident: None,
- colon_token: None,
- ty: Path(
- TypePath {
- qself: None,
- path: Path {
- leading_colon: None,
- segments: [
- PathSegment {
- ident: Ident(
- T,
- ),
- arguments: None,
- },
- ],
- },
- },
- ),
- },
- ],
- },
- ),
- discriminant: None,
- },
- Comma,
- Variant {
- attrs: [],
- ident: Ident(
- Err,
- ),
- fields: Unnamed(
- FieldsUnnamed {
- paren_token: Paren,
- unnamed: [
- Field {
- attrs: [],
- vis: Inherited,
- ident: None,
- colon_token: None,
- ty: Path(
- TypePath {
- qself: None,
- path: Path {
- leading_colon: None,
- segments: [
- PathSegment {
- ident: Ident(
- E,
- ),
- arguments: None,
- },
- ],
- },
- },
- ),
- },
- ],
- },
- ),
- discriminant: None,
- },
- Comma,
- Variant {
- attrs: [],
- ident: Ident(
- Surprise,
- ),
- fields: Unit,
- discriminant: Some(
- (
- Eq,
- Lit(
- ExprLit {
- attrs: [],
- lit: Int(
- LitInt {
- token: Literal {
- lit: 0isize,
- },
- },
- ),
- },
- ),
- ),
- ),
- },
- Comma,
- Variant {
- attrs: [],
- ident: Ident(
- ProcMacroHack,
- ),
- fields: Unit,
- discriminant: Some(
- (
- Eq,
- Field(
- ExprField {
- attrs: [],
- base: Tuple(
- ExprTuple {
- attrs: [],
- paren_token: Paren,
- elems: [
- Lit(
- ExprLit {
- attrs: [],
- lit: Int(
- LitInt {
- token: Literal {
- lit: 0,
- },
- },
- ),
- },
- ),
- Comma,
- Lit(
- ExprLit {
- attrs: [],
- lit: Str(
- LitStr {
- token: Literal {
- lit: "data",
- },
- },
- ),
- },
- ),
- ],
- },
- ),
- dot_token: Dot,
- member: Unnamed(
- Index {
- index: 0,
- span: Span,
- },
- ),
- },
- ),
- ),
- ),
- },
- ],
- },
- ),
-}
diff --git a/tests/snapshots/test_derive_input__fields_on_named_struct-2.snap b/tests/snapshots/test_derive_input__fields_on_named_struct-2.snap
deleted file mode 100644
index 8624287..0000000
--- a/tests/snapshots/test_derive_input__fields_on_named_struct-2.snap
+++ /dev/null
@@ -1,68 +0,0 @@
----
-created: "2019-04-06T05:46:03.356119693Z"
-creator: insta@0.7.4
-source: tests/test_derive_input.rs
-expression: syntax_tree
----
-[
- Field {
- attrs: [],
- vis: Inherited,
- ident: Some(
- Ident(
- foo,
- ),
- ),
- colon_token: Some(
- Colon,
- ),
- ty: Path(
- TypePath {
- qself: None,
- path: Path {
- leading_colon: None,
- segments: [
- PathSegment {
- ident: Ident(
- i32,
- ),
- arguments: None,
- },
- ],
- },
- },
- ),
- },
- Field {
- attrs: [],
- vis: Public(
- VisPublic {
- pub_token: Pub,
- },
- ),
- ident: Some(
- Ident(
- bar,
- ),
- ),
- colon_token: Some(
- Colon,
- ),
- ty: Path(
- TypePath {
- qself: None,
- path: Path {
- leading_colon: None,
- segments: [
- PathSegment {
- ident: Ident(
- String,
- ),
- arguments: None,
- },
- ],
- },
- },
- ),
- },
-]
diff --git a/tests/snapshots/test_derive_input__fields_on_named_struct.snap b/tests/snapshots/test_derive_input__fields_on_named_struct.snap
deleted file mode 100644
index 5625268..0000000
--- a/tests/snapshots/test_derive_input__fields_on_named_struct.snap
+++ /dev/null
@@ -1,94 +0,0 @@
----
-created: "2019-04-06T05:46:03.344622027Z"
-creator: insta@0.7.4
-source: tests/test_derive_input.rs
-expression: syntax_tree
----
-DeriveInput {
- attrs: [],
- vis: Inherited,
- ident: Ident(
- S,
- ),
- generics: Generics {
- lt_token: None,
- params: [],
- gt_token: None,
- where_clause: None,
- },
- data: Struct(
- DataStruct {
- struct_token: Struct,
- fields: Named(
- FieldsNamed {
- brace_token: Brace,
- named: [
- Field {
- attrs: [],
- vis: Inherited,
- ident: Some(
- Ident(
- foo,
- ),
- ),
- colon_token: Some(
- Colon,
- ),
- ty: Path(
- TypePath {
- qself: None,
- path: Path {
- leading_colon: None,
- segments: [
- PathSegment {
- ident: Ident(
- i32,
- ),
- arguments: None,
- },
- ],
- },
- },
- ),
- },
- Comma,
- Field {
- attrs: [],
- vis: Public(
- VisPublic {
- pub_token: Pub,
- },
- ),
- ident: Some(
- Ident(
- bar,
- ),
- ),
- colon_token: Some(
- Colon,
- ),
- ty: Path(
- TypePath {
- qself: None,
- path: Path {
- leading_colon: None,
- segments: [
- PathSegment {
- ident: Ident(
- String,
- ),
- arguments: None,
- },
- ],
- },
- },
- ),
- },
- Comma,
- ],
- },
- ),
- semi_token: None,
- },
- ),
-}
diff --git a/tests/snapshots/test_derive_input__fields_on_tuple_struct-2.snap b/tests/snapshots/test_derive_input__fields_on_tuple_struct-2.snap
deleted file mode 100644
index 9765bfb..0000000
--- a/tests/snapshots/test_derive_input__fields_on_tuple_struct-2.snap
+++ /dev/null
@@ -1,56 +0,0 @@
----
-created: "2019-04-06T05:46:03.356076965Z"
-creator: insta@0.7.4
-source: tests/test_derive_input.rs
-expression: syntax_tree
----
-[
- Field {
- attrs: [],
- vis: Inherited,
- ident: None,
- colon_token: None,
- ty: Path(
- TypePath {
- qself: None,
- path: Path {
- leading_colon: None,
- segments: [
- PathSegment {
- ident: Ident(
- i32,
- ),
- arguments: None,
- },
- ],
- },
- },
- ),
- },
- Field {
- attrs: [],
- vis: Public(
- VisPublic {
- pub_token: Pub,
- },
- ),
- ident: None,
- colon_token: None,
- ty: Path(
- TypePath {
- qself: None,
- path: Path {
- leading_colon: None,
- segments: [
- PathSegment {
- ident: Ident(
- String,
- ),
- arguments: None,
- },
- ],
- },
- },
- ),
- },
-]
diff --git a/tests/snapshots/test_derive_input__fields_on_tuple_struct.snap b/tests/snapshots/test_derive_input__fields_on_tuple_struct.snap
deleted file mode 100644
index 5becfed..0000000
--- a/tests/snapshots/test_derive_input__fields_on_tuple_struct.snap
+++ /dev/null
@@ -1,83 +0,0 @@
----
-created: "2019-04-06T05:46:03.345437941Z"
-creator: insta@0.7.4
-source: tests/test_derive_input.rs
-expression: syntax_tree
----
-DeriveInput {
- attrs: [],
- vis: Inherited,
- ident: Ident(
- S,
- ),
- generics: Generics {
- lt_token: None,
- params: [],
- gt_token: None,
- where_clause: None,
- },
- data: Struct(
- DataStruct {
- struct_token: Struct,
- fields: Unnamed(
- FieldsUnnamed {
- paren_token: Paren,
- unnamed: [
- Field {
- attrs: [],
- vis: Inherited,
- ident: None,
- colon_token: None,
- ty: Path(
- TypePath {
- qself: None,
- path: Path {
- leading_colon: None,
- segments: [
- PathSegment {
- ident: Ident(
- i32,
- ),
- arguments: None,
- },
- ],
- },
- },
- ),
- },
- Comma,
- Field {
- attrs: [],
- vis: Public(
- VisPublic {
- pub_token: Pub,
- },
- ),
- ident: None,
- colon_token: None,
- ty: Path(
- TypePath {
- qself: None,
- path: Path {
- leading_colon: None,
- segments: [
- PathSegment {
- ident: Ident(
- String,
- ),
- arguments: None,
- },
- ],
- },
- },
- ),
- },
- ],
- },
- ),
- semi_token: Some(
- Semi,
- ),
- },
- ),
-}
diff --git a/tests/snapshots/test_derive_input__fields_on_unit_struct.snap b/tests/snapshots/test_derive_input__fields_on_unit_struct.snap
deleted file mode 100644
index d386c95..0000000
--- a/tests/snapshots/test_derive_input__fields_on_unit_struct.snap
+++ /dev/null
@@ -1,28 +0,0 @@
----
-created: "2019-04-06T05:46:03.346933082Z"
-creator: insta@0.7.4
-source: tests/test_derive_input.rs
-expression: syntax_tree
----
-DeriveInput {
- attrs: [],
- vis: Inherited,
- ident: Ident(
- S,
- ),
- generics: Generics {
- lt_token: None,
- params: [],
- gt_token: None,
- where_clause: None,
- },
- data: Struct(
- DataStruct {
- struct_token: Struct,
- fields: Unit,
- semi_token: Some(
- Semi,
- ),
- },
- ),
-}
diff --git a/tests/snapshots/test_derive_input__pub_restricted.snap b/tests/snapshots/test_derive_input__pub_restricted.snap
deleted file mode 100644
index c4d137d..0000000
--- a/tests/snapshots/test_derive_input__pub_restricted.snap
+++ /dev/null
@@ -1,101 +0,0 @@
----
-created: "2019-04-06T05:46:03.356852227Z"
-creator: insta@0.7.4
-source: tests/test_derive_input.rs
-expression: syntax_tree
----
-DeriveInput {
- attrs: [],
- vis: Restricted(
- VisRestricted {
- pub_token: Pub,
- paren_token: Paren,
- in_token: Some(
- In,
- ),
- path: Path {
- leading_colon: None,
- segments: [
- PathSegment {
- ident: Ident(
- m,
- ),
- arguments: None,
- },
- ],
- },
- },
- ),
- ident: Ident(
- Z,
- ),
- generics: Generics {
- lt_token: None,
- params: [],
- gt_token: None,
- where_clause: None,
- },
- data: Struct(
- DataStruct {
- struct_token: Struct,
- fields: Unnamed(
- FieldsUnnamed {
- paren_token: Paren,
- unnamed: [
- Field {
- attrs: [],
- vis: Restricted(
- VisRestricted {
- pub_token: Pub,
- paren_token: Paren,
- in_token: Some(
- In,
- ),
- path: Path {
- leading_colon: None,
- segments: [
- PathSegment {
- ident: Ident(
- m,
- ),
- arguments: None,
- },
- Colon2,
- PathSegment {
- ident: Ident(
- n,
- ),
- arguments: None,
- },
- ],
- },
- },
- ),
- ident: None,
- colon_token: None,
- ty: Path(
- TypePath {
- qself: None,
- path: Path {
- leading_colon: None,
- segments: [
- PathSegment {
- ident: Ident(
- u8,
- ),
- arguments: None,
- },
- ],
- },
- },
- ),
- },
- ],
- },
- ),
- semi_token: Some(
- Semi,
- ),
- },
- ),
-}
diff --git a/tests/snapshots/test_derive_input__pub_restricted_crate.snap b/tests/snapshots/test_derive_input__pub_restricted_crate.snap
deleted file mode 100644
index dc095bc..0000000
--- a/tests/snapshots/test_derive_input__pub_restricted_crate.snap
+++ /dev/null
@@ -1,45 +0,0 @@
----
-created: "2019-04-06T05:46:03.367396988Z"
-creator: insta@0.7.4
-source: tests/test_derive_input.rs
-expression: syntax_tree
----
-DeriveInput {
- attrs: [],
- vis: Restricted(
- VisRestricted {
- pub_token: Pub,
- paren_token: Paren,
- in_token: None,
- path: Path {
- leading_colon: None,
- segments: [
- PathSegment {
- ident: Ident(
- crate,
- ),
- arguments: None,
- },
- ],
- },
- },
- ),
- ident: Ident(
- S,
- ),
- generics: Generics {
- lt_token: None,
- params: [],
- gt_token: None,
- where_clause: None,
- },
- data: Struct(
- DataStruct {
- struct_token: Struct,
- fields: Unit,
- semi_token: Some(
- Semi,
- ),
- },
- ),
-}
diff --git a/tests/snapshots/test_derive_input__pub_restricted_in_super.snap b/tests/snapshots/test_derive_input__pub_restricted_in_super.snap
deleted file mode 100644
index 364d0b0..0000000
--- a/tests/snapshots/test_derive_input__pub_restricted_in_super.snap
+++ /dev/null
@@ -1,47 +0,0 @@
----
-created: "2019-04-06T05:46:03.367480987Z"
-creator: insta@0.7.4
-source: tests/test_derive_input.rs
-expression: syntax_tree
----
-DeriveInput {
- attrs: [],
- vis: Restricted(
- VisRestricted {
- pub_token: Pub,
- paren_token: Paren,
- in_token: Some(
- In,
- ),
- path: Path {
- leading_colon: None,
- segments: [
- PathSegment {
- ident: Ident(
- super,
- ),
- arguments: None,
- },
- ],
- },
- },
- ),
- ident: Ident(
- S,
- ),
- generics: Generics {
- lt_token: None,
- params: [],
- gt_token: None,
- where_clause: None,
- },
- data: Struct(
- DataStruct {
- struct_token: Struct,
- fields: Unit,
- semi_token: Some(
- Semi,
- ),
- },
- ),
-}
diff --git a/tests/snapshots/test_derive_input__pub_restricted_super.snap b/tests/snapshots/test_derive_input__pub_restricted_super.snap
deleted file mode 100644
index 310a2d5..0000000
--- a/tests/snapshots/test_derive_input__pub_restricted_super.snap
+++ /dev/null
@@ -1,45 +0,0 @@
----
-created: "2019-04-06T05:46:03.372511650Z"
-creator: insta@0.7.4
-source: tests/test_derive_input.rs
-expression: syntax_tree
----
-DeriveInput {
- attrs: [],
- vis: Restricted(
- VisRestricted {
- pub_token: Pub,
- paren_token: Paren,
- in_token: None,
- path: Path {
- leading_colon: None,
- segments: [
- PathSegment {
- ident: Ident(
- super,
- ),
- arguments: None,
- },
- ],
- },
- },
- ),
- ident: Ident(
- S,
- ),
- generics: Generics {
- lt_token: None,
- params: [],
- gt_token: None,
- where_clause: None,
- },
- data: Struct(
- DataStruct {
- struct_token: Struct,
- fields: Unit,
- semi_token: Some(
- Semi,
- ),
- },
- ),
-}
diff --git a/tests/snapshots/test_derive_input__struct-2.snap b/tests/snapshots/test_derive_input__struct-2.snap
deleted file mode 100644
index 5515772..0000000
--- a/tests/snapshots/test_derive_input__struct-2.snap
+++ /dev/null
@@ -1,31 +0,0 @@
----
-created: "2019-04-06T05:46:03.385565379Z"
-creator: insta@0.7.4
-source: tests/test_derive_input.rs
-expression: syntax_tree
----
-List(
- MetaList {
- ident: Ident(
- derive,
- ),
- paren_token: Paren,
- nested: [
- Meta(
- Word(
- Ident(
- Debug,
- ),
- ),
- ),
- Comma,
- Meta(
- Word(
- Ident(
- Clone,
- ),
- ),
- ),
- ],
- },
-)
diff --git a/tests/snapshots/test_derive_input__struct.snap b/tests/snapshots/test_derive_input__struct.snap
deleted file mode 100644
index 30ffe9b..0000000
--- a/tests/snapshots/test_derive_input__struct.snap
+++ /dev/null
@@ -1,161 +0,0 @@
----
-created: "2019-04-06T05:46:03.372588353Z"
-creator: insta@0.7.4
-source: tests/test_derive_input.rs
-expression: syntax_tree
----
-DeriveInput {
- attrs: [
- Attribute {
- pound_token: Pound,
- style: Outer,
- bracket_token: Bracket,
- path: Path {
- leading_colon: None,
- segments: [
- PathSegment {
- ident: Ident(
- derive,
- ),
- arguments: None,
- },
- ],
- },
- tts: TokenStream [
- Group {
- delimiter: Parenthesis,
- stream: TokenStream [
- Ident {
- sym: Debug,
- },
- Punct {
- op: ',',
- spacing: Alone,
- },
- Ident {
- sym: Clone,
- },
- ],
- },
- ],
- },
- ],
- vis: Public(
- VisPublic {
- pub_token: Pub,
- },
- ),
- ident: Ident(
- Item,
- ),
- generics: Generics {
- lt_token: None,
- params: [],
- gt_token: None,
- where_clause: None,
- },
- data: Struct(
- DataStruct {
- struct_token: Struct,
- fields: Named(
- FieldsNamed {
- brace_token: Brace,
- named: [
- Field {
- attrs: [],
- vis: Public(
- VisPublic {
- pub_token: Pub,
- },
- ),
- ident: Some(
- Ident(
- ident,
- ),
- ),
- colon_token: Some(
- Colon,
- ),
- ty: Path(
- TypePath {
- qself: None,
- path: Path {
- leading_colon: None,
- segments: [
- PathSegment {
- ident: Ident(
- Ident,
- ),
- arguments: None,
- },
- ],
- },
- },
- ),
- },
- Comma,
- Field {
- attrs: [],
- vis: Public(
- VisPublic {
- pub_token: Pub,
- },
- ),
- ident: Some(
- Ident(
- attrs,
- ),
- ),
- colon_token: Some(
- Colon,
- ),
- ty: Path(
- TypePath {
- qself: None,
- path: Path {
- leading_colon: None,
- segments: [
- PathSegment {
- ident: Ident(
- Vec,
- ),
- arguments: AngleBracketed(
- AngleBracketedGenericArguments {
- colon2_token: None,
- lt_token: Lt,
- args: [
- Type(
- Path(
- TypePath {
- qself: None,
- path: Path {
- leading_colon: None,
- segments: [
- PathSegment {
- ident: Ident(
- Attribute,
- ),
- arguments: None,
- },
- ],
- },
- },
- ),
- ),
- ],
- gt_token: Gt,
- },
- ),
- },
- ],
- },
- },
- ),
- },
- ],
- },
- ),
- semi_token: None,
- },
- ),
-}
diff --git a/tests/snapshots/test_derive_input__union.snap b/tests/snapshots/test_derive_input__union.snap
deleted file mode 100644
index b6989e7..0000000
--- a/tests/snapshots/test_derive_input__union.snap
+++ /dev/null
@@ -1,93 +0,0 @@
----
-created: "2019-04-06T05:46:03.379296830Z"
-creator: insta@0.7.4
-source: tests/test_derive_input.rs
-expression: syntax_tree
----
-DeriveInput {
- attrs: [],
- vis: Inherited,
- ident: Ident(
- MaybeUninit,
- ),
- generics: Generics {
- lt_token: Some(
- Lt,
- ),
- params: [
- Type(
- TypeParam {
- attrs: [],
- ident: Ident(
- T,
- ),
- colon_token: None,
- bounds: [],
- eq_token: None,
- default: None,
- },
- ),
- ],
- gt_token: Some(
- Gt,
- ),
- where_clause: None,
- },
- data: Union(
- DataUnion {
- union_token: Union,
- fields: FieldsNamed {
- brace_token: Brace,
- named: [
- Field {
- attrs: [],
- vis: Inherited,
- ident: Some(
- Ident(
- uninit,
- ),
- ),
- colon_token: Some(
- Colon,
- ),
- ty: Tuple(
- TypeTuple {
- paren_token: Paren,
- elems: [],
- },
- ),
- },
- Comma,
- Field {
- attrs: [],
- vis: Inherited,
- ident: Some(
- Ident(
- value,
- ),
- ),
- colon_token: Some(
- Colon,
- ),
- ty: Path(
- TypePath {
- qself: None,
- path: Path {
- leading_colon: None,
- segments: [
- PathSegment {
- ident: Ident(
- T,
- ),
- arguments: None,
- },
- ],
- },
- },
- ),
- },
- ],
- },
- },
- ),
-}
diff --git a/tests/snapshots/test_derive_input__unit.snap b/tests/snapshots/test_derive_input__unit.snap
deleted file mode 100644
index 71110f2..0000000
--- a/tests/snapshots/test_derive_input__unit.snap
+++ /dev/null
@@ -1,28 +0,0 @@
----
-created: "2019-04-06T05:46:03.380028601Z"
-creator: insta@0.7.4
-source: tests/test_derive_input.rs
-expression: syntax_tree
----
-DeriveInput {
- attrs: [],
- vis: Inherited,
- ident: Ident(
- Unit,
- ),
- generics: Generics {
- lt_token: None,
- params: [],
- gt_token: None,
- where_clause: None,
- },
- data: Struct(
- DataStruct {
- struct_token: Struct,
- fields: Unit,
- semi_token: Some(
- Semi,
- ),
- },
- ),
-}
diff --git a/tests/snapshots/test_derive_input__vis_crate.snap b/tests/snapshots/test_derive_input__vis_crate.snap
deleted file mode 100644
index 1106d57..0000000
--- a/tests/snapshots/test_derive_input__vis_crate.snap
+++ /dev/null
@@ -1,32 +0,0 @@
----
-created: "2019-04-06T05:46:03.382583229Z"
-creator: insta@0.7.4
-source: tests/test_derive_input.rs
-expression: syntax_tree
----
-DeriveInput {
- attrs: [],
- vis: Crate(
- VisCrate {
- crate_token: Crate,
- },
- ),
- ident: Ident(
- S,
- ),
- generics: Generics {
- lt_token: None,
- params: [],
- gt_token: None,
- where_clause: None,
- },
- data: Struct(
- DataStruct {
- struct_token: Struct,
- fields: Unit,
- semi_token: Some(
- Semi,
- ),
- },
- ),
-}
diff --git a/tests/snapshots/test_generics__fn_precedence_in_where_clause.snap b/tests/snapshots/test_generics__fn_precedence_in_where_clause.snap
deleted file mode 100644
index d234ced..0000000
--- a/tests/snapshots/test_generics__fn_precedence_in_where_clause.snap
+++ /dev/null
@@ -1,143 +0,0 @@
----
-created: "2019-04-06T05:46:03.403638381Z"
-creator: insta@0.7.4
-source: tests/test_generics.rs
-expression: syntax_tree
----
-ItemFn {
- attrs: [],
- vis: Inherited,
- constness: None,
- unsafety: None,
- asyncness: None,
- abi: None,
- ident: Ident(
- f,
- ),
- decl: FnDecl {
- fn_token: Fn,
- generics: Generics {
- lt_token: Some(
- Lt,
- ),
- params: [
- Type(
- TypeParam {
- attrs: [],
- ident: Ident(
- G,
- ),
- colon_token: None,
- bounds: [],
- eq_token: None,
- default: None,
- },
- ),
- ],
- gt_token: Some(
- Gt,
- ),
- where_clause: Some(
- WhereClause {
- where_token: Where,
- predicates: [
- Type(
- PredicateType {
- lifetimes: None,
- bounded_ty: Path(
- TypePath {
- qself: None,
- path: Path {
- leading_colon: None,
- segments: [
- PathSegment {
- ident: Ident(
- G,
- ),
- arguments: None,
- },
- ],
- },
- },
- ),
- colon_token: Colon,
- bounds: [
- Trait(
- TraitBound {
- paren_token: None,
- modifier: None,
- lifetimes: None,
- path: Path {
- leading_colon: None,
- segments: [
- PathSegment {
- ident: Ident(
- FnOnce,
- ),
- arguments: Parenthesized(
- ParenthesizedGenericArguments {
- paren_token: Paren,
- inputs: [],
- output: Type(
- RArrow,
- Path(
- TypePath {
- qself: None,
- path: Path {
- leading_colon: None,
- segments: [
- PathSegment {
- ident: Ident(
- i32,
- ),
- arguments: None,
- },
- ],
- },
- },
- ),
- ),
- },
- ),
- },
- ],
- },
- },
- ),
- Add,
- Trait(
- TraitBound {
- paren_token: None,
- modifier: None,
- lifetimes: None,
- path: Path {
- leading_colon: None,
- segments: [
- PathSegment {
- ident: Ident(
- Send,
- ),
- arguments: None,
- },
- ],
- },
- },
- ),
- ],
- },
- ),
- Comma,
- ],
- },
- ),
- },
- paren_token: Paren,
- inputs: [],
- variadic: None,
- output: Default,
- },
- block: Block {
- brace_token: Brace,
- stmts: [],
- },
-}
diff --git a/tests/snapshots/test_generics__split_for_impl.snap b/tests/snapshots/test_generics__split_for_impl.snap
deleted file mode 100644
index 24d5ac2..0000000
--- a/tests/snapshots/test_generics__split_for_impl.snap
+++ /dev/null
@@ -1,168 +0,0 @@
----
-created: "2019-04-06T05:46:03.403744852Z"
-creator: insta@0.7.4
-source: tests/test_generics.rs
-expression: syntax_tree
----
-DeriveInput {
- attrs: [],
- vis: Inherited,
- ident: Ident(
- S,
- ),
- generics: Generics {
- lt_token: Some(
- Lt,
- ),
- params: [
- Lifetime(
- LifetimeDef {
- attrs: [],
- lifetime: Lifetime {
- apostrophe: Span,
- ident: Ident(
- a,
- ),
- },
- colon_token: None,
- bounds: [],
- },
- ),
- Comma,
- Lifetime(
- LifetimeDef {
- attrs: [],
- lifetime: Lifetime {
- apostrophe: Span,
- ident: Ident(
- b,
- ),
- },
- colon_token: Some(
- Colon,
- ),
- bounds: [
- Lifetime {
- apostrophe: Span,
- ident: Ident(
- a,
- ),
- },
- ],
- },
- ),
- Comma,
- Type(
- TypeParam {
- attrs: [
- Attribute {
- pound_token: Pound,
- style: Outer,
- bracket_token: Bracket,
- path: Path {
- leading_colon: None,
- segments: [
- PathSegment {
- ident: Ident(
- may_dangle,
- ),
- arguments: None,
- },
- ],
- },
- tts: TokenStream [],
- },
- ],
- ident: Ident(
- T,
- ),
- colon_token: Some(
- Colon,
- ),
- bounds: [
- Lifetime(
- Lifetime {
- apostrophe: Span,
- ident: Ident(
- a,
- ),
- },
- ),
- ],
- eq_token: Some(
- Eq,
- ),
- default: Some(
- Tuple(
- TypeTuple {
- paren_token: Paren,
- elems: [],
- },
- ),
- ),
- },
- ),
- ],
- gt_token: Some(
- Gt,
- ),
- where_clause: Some(
- WhereClause {
- where_token: Where,
- predicates: [
- Type(
- PredicateType {
- lifetimes: None,
- bounded_ty: Path(
- TypePath {
- qself: None,
- path: Path {
- leading_colon: None,
- segments: [
- PathSegment {
- ident: Ident(
- T,
- ),
- arguments: None,
- },
- ],
- },
- },
- ),
- colon_token: Colon,
- bounds: [
- Trait(
- TraitBound {
- paren_token: None,
- modifier: None,
- lifetimes: None,
- path: Path {
- leading_colon: None,
- segments: [
- PathSegment {
- ident: Ident(
- Debug,
- ),
- arguments: None,
- },
- ],
- },
- },
- ),
- ],
- },
- ),
- ],
- },
- ),
- },
- data: Struct(
- DataStruct {
- struct_token: Struct,
- fields: Unit,
- semi_token: Some(
- Semi,
- ),
- },
- ),
-}
diff --git a/tests/snapshots/test_generics__ty_param_bound-2.snap b/tests/snapshots/test_generics__ty_param_bound-2.snap
deleted file mode 100644
index 74b5c6b..0000000
--- a/tests/snapshots/test_generics__ty_param_bound-2.snap
+++ /dev/null
@@ -1,14 +0,0 @@
----
-created: "2019-04-06T05:46:03.413908514Z"
-creator: insta@0.7.4
-source: tests/test_generics.rs
-expression: syntax_tree
----
-Lifetime(
- Lifetime {
- apostrophe: Span,
- ident: Ident(
- _,
- ),
- },
-)
diff --git a/tests/snapshots/test_generics__ty_param_bound-3.snap b/tests/snapshots/test_generics__ty_param_bound-3.snap
deleted file mode 100644
index 7f145d1..0000000
--- a/tests/snapshots/test_generics__ty_param_bound-3.snap
+++ /dev/null
@@ -1,24 +0,0 @@
----
-created: "2019-04-06T05:46:03.423193566Z"
-creator: insta@0.7.4
-source: tests/test_generics.rs
-expression: syntax_tree
----
-Trait(
- TraitBound {
- paren_token: None,
- modifier: None,
- lifetimes: None,
- path: Path {
- leading_colon: None,
- segments: [
- PathSegment {
- ident: Ident(
- Debug,
- ),
- arguments: None,
- },
- ],
- },
- },
-)
diff --git a/tests/snapshots/test_generics__ty_param_bound-4.snap b/tests/snapshots/test_generics__ty_param_bound-4.snap
deleted file mode 100644
index d17a9b1..0000000
--- a/tests/snapshots/test_generics__ty_param_bound-4.snap
+++ /dev/null
@@ -1,26 +0,0 @@
----
-created: "2019-04-06T05:46:03.430557740Z"
-creator: insta@0.7.4
-source: tests/test_generics.rs
-expression: syntax_tree
----
-Trait(
- TraitBound {
- paren_token: None,
- modifier: Maybe(
- Question,
- ),
- lifetimes: None,
- path: Path {
- leading_colon: None,
- segments: [
- PathSegment {
- ident: Ident(
- Sized,
- ),
- arguments: None,
- },
- ],
- },
- },
-)
diff --git a/tests/snapshots/test_generics__ty_param_bound.snap b/tests/snapshots/test_generics__ty_param_bound.snap
deleted file mode 100644
index 07dae41..0000000
--- a/tests/snapshots/test_generics__ty_param_bound.snap
+++ /dev/null
@@ -1,14 +0,0 @@
----
-created: "2019-04-06T05:46:03.403649410Z"
-creator: insta@0.7.4
-source: tests/test_generics.rs
-expression: syntax_tree
----
-Lifetime(
- Lifetime {
- apostrophe: Span,
- ident: Ident(
- a,
- ),
- },
-)
diff --git a/tests/snapshots/test_generics__where_clause_at_end_of_input.snap b/tests/snapshots/test_generics__where_clause_at_end_of_input.snap
deleted file mode 100644
index d4e22c2..0000000
--- a/tests/snapshots/test_generics__where_clause_at_end_of_input.snap
+++ /dev/null
@@ -1,10 +0,0 @@
----
-created: "2019-04-06T05:46:03.403623350Z"
-creator: insta@0.7.4
-source: tests/test_generics.rs
-expression: syntax_tree
----
-WhereClause {
- where_token: Where,
- predicates: [],
-}
diff --git a/tests/snapshots/test_grouping__grouping.snap b/tests/snapshots/test_grouping__grouping.snap
deleted file mode 100644
index b9177f5..0000000
--- a/tests/snapshots/test_grouping__grouping.snap
+++ /dev/null
@@ -1,84 +0,0 @@
----
-created: "2019-04-06T05:46:03.447914316Z"
-creator: insta@0.7.4
-source: tests/test_grouping.rs
-expression: syntax_tree
----
-Binary(
- ExprBinary {
- attrs: [],
- left: Lit(
- ExprLit {
- attrs: [],
- lit: Int(
- LitInt {
- token: Literal {
- lit: 1i32,
- },
- },
- ),
- },
- ),
- op: Add(
- Add,
- ),
- right: Binary(
- ExprBinary {
- attrs: [],
- left: Group(
- ExprGroup {
- attrs: [],
- group_token: Group,
- expr: Binary(
- ExprBinary {
- attrs: [],
- left: Lit(
- ExprLit {
- attrs: [],
- lit: Int(
- LitInt {
- token: Literal {
- lit: 2i32,
- },
- },
- ),
- },
- ),
- op: Add(
- Add,
- ),
- right: Lit(
- ExprLit {
- attrs: [],
- lit: Int(
- LitInt {
- token: Literal {
- lit: 3i32,
- },
- },
- ),
- },
- ),
- },
- ),
- },
- ),
- op: Mul(
- Star,
- ),
- right: Lit(
- ExprLit {
- attrs: [],
- lit: Int(
- LitInt {
- token: Literal {
- lit: 4i32,
- },
- },
- ),
- },
- ),
- },
- ),
- },
-)
diff --git a/tests/snapshots/test_meta__parse_meta_item_list_lit-2.snap b/tests/snapshots/test_meta__parse_meta_item_list_lit-2.snap
deleted file mode 100644
index cd52abf..0000000
--- a/tests/snapshots/test_meta__parse_meta_item_list_lit-2.snap
+++ /dev/null
@@ -1,25 +0,0 @@
----
-created: "2019-04-06T05:46:03.482633781Z"
-creator: insta@0.7.4
-source: tests/test_meta.rs
-expression: syntax_tree
----
-List(
- MetaList {
- ident: Ident(
- foo,
- ),
- paren_token: Paren,
- nested: [
- Literal(
- Int(
- LitInt {
- token: Literal {
- lit: 5,
- },
- },
- ),
- ),
- ],
- },
-)
diff --git a/tests/snapshots/test_meta__parse_meta_item_list_lit.snap b/tests/snapshots/test_meta__parse_meta_item_list_lit.snap
deleted file mode 100644
index b713886..0000000
--- a/tests/snapshots/test_meta__parse_meta_item_list_lit.snap
+++ /dev/null
@@ -1,23 +0,0 @@
----
-created: "2019-04-06T05:46:03.470744919Z"
-creator: insta@0.7.4
-source: tests/test_meta.rs
-expression: syntax_tree
----
-MetaList {
- ident: Ident(
- foo,
- ),
- paren_token: Paren,
- nested: [
- Literal(
- Int(
- LitInt {
- token: Literal {
- lit: 5,
- },
- },
- ),
- ),
- ],
-}
diff --git a/tests/snapshots/test_meta__parse_meta_item_multiple-2.snap b/tests/snapshots/test_meta__parse_meta_item_multiple-2.snap
deleted file mode 100644
index 5fc7785..0000000
--- a/tests/snapshots/test_meta__parse_meta_item_multiple-2.snap
+++ /dev/null
@@ -1,79 +0,0 @@
----
-created: "2019-04-06T05:46:03.486120819Z"
-creator: insta@0.7.4
-source: tests/test_meta.rs
-expression: syntax_tree
----
-List(
- MetaList {
- ident: Ident(
- foo,
- ),
- paren_token: Paren,
- nested: [
- Meta(
- Word(
- Ident(
- word,
- ),
- ),
- ),
- Comma,
- Meta(
- NameValue(
- MetaNameValue {
- ident: Ident(
- name,
- ),
- eq_token: Eq,
- lit: Int(
- LitInt {
- token: Literal {
- lit: 5,
- },
- },
- ),
- },
- ),
- ),
- Comma,
- Meta(
- List(
- MetaList {
- ident: Ident(
- list,
- ),
- paren_token: Paren,
- nested: [
- Meta(
- NameValue(
- MetaNameValue {
- ident: Ident(
- name2,
- ),
- eq_token: Eq,
- lit: Int(
- LitInt {
- token: Literal {
- lit: 6,
- },
- },
- ),
- },
- ),
- ),
- ],
- },
- ),
- ),
- Comma,
- Meta(
- Word(
- Ident(
- word2,
- ),
- ),
- ),
- ],
- },
-)
diff --git a/tests/snapshots/test_meta__parse_meta_item_multiple.snap b/tests/snapshots/test_meta__parse_meta_item_multiple.snap
deleted file mode 100644
index 40cb8e7..0000000
--- a/tests/snapshots/test_meta__parse_meta_item_multiple.snap
+++ /dev/null
@@ -1,77 +0,0 @@
----
-created: "2019-04-06T05:46:03.470754527Z"
-creator: insta@0.7.4
-source: tests/test_meta.rs
-expression: syntax_tree
----
-MetaList {
- ident: Ident(
- foo,
- ),
- paren_token: Paren,
- nested: [
- Meta(
- Word(
- Ident(
- word,
- ),
- ),
- ),
- Comma,
- Meta(
- NameValue(
- MetaNameValue {
- ident: Ident(
- name,
- ),
- eq_token: Eq,
- lit: Int(
- LitInt {
- token: Literal {
- lit: 5,
- },
- },
- ),
- },
- ),
- ),
- Comma,
- Meta(
- List(
- MetaList {
- ident: Ident(
- list,
- ),
- paren_token: Paren,
- nested: [
- Meta(
- NameValue(
- MetaNameValue {
- ident: Ident(
- name2,
- ),
- eq_token: Eq,
- lit: Int(
- LitInt {
- token: Literal {
- lit: 6,
- },
- },
- ),
- },
- ),
- ),
- ],
- },
- ),
- ),
- Comma,
- Meta(
- Word(
- Ident(
- word2,
- ),
- ),
- ),
- ],
-}
diff --git a/tests/snapshots/test_meta__parse_meta_item_word.snap b/tests/snapshots/test_meta__parse_meta_item_word.snap
deleted file mode 100644
index c23f3ad..0000000
--- a/tests/snapshots/test_meta__parse_meta_item_word.snap
+++ /dev/null
@@ -1,11 +0,0 @@
----
-created: "2019-04-06T05:46:03.470744921Z"
-creator: insta@0.7.4
-source: tests/test_meta.rs
-expression: syntax_tree
----
-Word(
- Ident(
- hello,
- ),
-)
diff --git a/tests/snapshots/test_meta__parse_meta_name_value-2.snap b/tests/snapshots/test_meta__parse_meta_name_value-2.snap
deleted file mode 100644
index a05d961..0000000
--- a/tests/snapshots/test_meta__parse_meta_name_value-2.snap
+++ /dev/null
@@ -1,21 +0,0 @@
----
-created: "2019-04-06T05:46:03.482968711Z"
-creator: insta@0.7.4
-source: tests/test_meta.rs
-expression: syntax_tree
----
-NameValue(
- MetaNameValue {
- ident: Ident(
- foo,
- ),
- eq_token: Eq,
- lit: Int(
- LitInt {
- token: Literal {
- lit: 5,
- },
- },
- ),
- },
-)
diff --git a/tests/snapshots/test_meta__parse_meta_name_value.snap b/tests/snapshots/test_meta__parse_meta_name_value.snap
deleted file mode 100644
index 8754191..0000000
--- a/tests/snapshots/test_meta__parse_meta_name_value.snap
+++ /dev/null
@@ -1,19 +0,0 @@
----
-created: "2019-04-06T05:46:03.470744904Z"
-creator: insta@0.7.4
-source: tests/test_meta.rs
-expression: syntax_tree
----
-MetaNameValue {
- ident: Ident(
- foo,
- ),
- eq_token: Eq,
- lit: Int(
- LitInt {
- token: Literal {
- lit: 5,
- },
- },
- ),
-}
diff --git a/tests/snapshots/test_meta__parse_meta_name_value_with_bool-2.snap b/tests/snapshots/test_meta__parse_meta_name_value_with_bool-2.snap
deleted file mode 100644
index 7f2416f..0000000
--- a/tests/snapshots/test_meta__parse_meta_name_value_with_bool-2.snap
+++ /dev/null
@@ -1,21 +0,0 @@
----
-created: "2019-04-06T05:46:03.495582812Z"
-creator: insta@0.7.4
-source: tests/test_meta.rs
-expression: syntax_tree
----
-NameValue(
- MetaNameValue {
- ident: Ident(
- true,
- ),
- eq_token: Eq,
- lit: Int(
- LitInt {
- token: Literal {
- lit: 5,
- },
- },
- ),
- },
-)
diff --git a/tests/snapshots/test_meta__parse_meta_name_value_with_bool.snap b/tests/snapshots/test_meta__parse_meta_name_value_with_bool.snap
deleted file mode 100644
index 88eaef4..0000000
--- a/tests/snapshots/test_meta__parse_meta_name_value_with_bool.snap
+++ /dev/null
@@ -1,19 +0,0 @@
----
-created: "2019-04-06T05:46:03.486232109Z"
-creator: insta@0.7.4
-source: tests/test_meta.rs
-expression: syntax_tree
----
-MetaNameValue {
- ident: Ident(
- true,
- ),
- eq_token: Eq,
- lit: Int(
- LitInt {
- token: Literal {
- lit: 5,
- },
- },
- ),
-}
diff --git a/tests/snapshots/test_meta__parse_meta_name_value_with_keyword-2.snap b/tests/snapshots/test_meta__parse_meta_name_value_with_keyword-2.snap
deleted file mode 100644
index 7dc1dfa..0000000
--- a/tests/snapshots/test_meta__parse_meta_name_value_with_keyword-2.snap
+++ /dev/null
@@ -1,21 +0,0 @@
----
-created: "2019-04-06T05:46:03.504660549Z"
-creator: insta@0.7.4
-source: tests/test_meta.rs
-expression: syntax_tree
----
-NameValue(
- MetaNameValue {
- ident: Ident(
- static,
- ),
- eq_token: Eq,
- lit: Int(
- LitInt {
- token: Literal {
- lit: 5,
- },
- },
- ),
- },
-)
diff --git a/tests/snapshots/test_meta__parse_meta_name_value_with_keyword.snap b/tests/snapshots/test_meta__parse_meta_name_value_with_keyword.snap
deleted file mode 100644
index cb101ea..0000000
--- a/tests/snapshots/test_meta__parse_meta_name_value_with_keyword.snap
+++ /dev/null
@@ -1,19 +0,0 @@
----
-created: "2019-04-06T05:46:03.494584273Z"
-creator: insta@0.7.4
-source: tests/test_meta.rs
-expression: syntax_tree
----
-MetaNameValue {
- ident: Ident(
- static,
- ),
- eq_token: Eq,
- lit: Int(
- LitInt {
- token: Literal {
- lit: 5,
- },
- },
- ),
-}
diff --git a/tests/snapshots/test_meta__parse_nested_meta-2.snap b/tests/snapshots/test_meta__parse_nested_meta-2.snap
deleted file mode 100644
index 8789bd4..0000000
--- a/tests/snapshots/test_meta__parse_nested_meta-2.snap
+++ /dev/null
@@ -1,35 +0,0 @@
----
-created: "2019-04-06T05:46:03.502810089Z"
-creator: insta@0.7.4
-source: tests/test_meta.rs
-expression: syntax_tree
----
-Meta(
- List(
- MetaList {
- ident: Ident(
- list,
- ),
- paren_token: Paren,
- nested: [
- Meta(
- NameValue(
- MetaNameValue {
- ident: Ident(
- name2,
- ),
- eq_token: Eq,
- lit: Int(
- LitInt {
- token: Literal {
- lit: 6,
- },
- },
- ),
- },
- ),
- ),
- ],
- },
- ),
-)
diff --git a/tests/snapshots/test_meta__parse_nested_meta.snap b/tests/snapshots/test_meta__parse_nested_meta.snap
deleted file mode 100644
index 442ccd3..0000000
--- a/tests/snapshots/test_meta__parse_nested_meta.snap
+++ /dev/null
@@ -1,15 +0,0 @@
----
-created: "2019-04-06T05:46:03.495607085Z"
-creator: insta@0.7.4
-source: tests/test_meta.rs
-expression: syntax_tree
----
-Literal(
- Int(
- LitInt {
- token: Literal {
- lit: 5,
- },
- },
- ),
-)
diff --git a/tests/snapshots/test_token_trees__struct.snap b/tests/snapshots/test_token_trees__struct.snap
deleted file mode 100644
index 74cdb0a..0000000
--- a/tests/snapshots/test_token_trees__struct.snap
+++ /dev/null
@@ -1,94 +0,0 @@
----
-created: "2019-04-06T05:46:23.184384152Z"
-creator: insta@0.7.4
-source: tests/test_token_trees.rs
-expression: syntax_tree
----
-TokenStream [
- Punct {
- op: '#',
- spacing: Alone,
- },
- Group {
- delimiter: Bracket,
- stream: TokenStream [
- Ident {
- sym: derive,
- },
- Group {
- delimiter: Parenthesis,
- stream: TokenStream [
- Ident {
- sym: Debug,
- },
- Punct {
- op: ',',
- spacing: Alone,
- },
- Ident {
- sym: Clone,
- },
- ],
- },
- ],
- },
- Ident {
- sym: pub,
- },
- Ident {
- sym: struct,
- },
- Ident {
- sym: Item,
- },
- Group {
- delimiter: Brace,
- stream: TokenStream [
- Ident {
- sym: pub,
- },
- Ident {
- sym: ident,
- },
- Punct {
- op: ':',
- spacing: Alone,
- },
- Ident {
- sym: Ident,
- },
- Punct {
- op: ',',
- spacing: Alone,
- },
- Ident {
- sym: pub,
- },
- Ident {
- sym: attrs,
- },
- Punct {
- op: ':',
- spacing: Alone,
- },
- Ident {
- sym: Vec,
- },
- Punct {
- op: '<',
- spacing: Alone,
- },
- Ident {
- sym: Attribute,
- },
- Punct {
- op: '>',
- spacing: Joint,
- },
- Punct {
- op: ',',
- spacing: Alone,
- },
- ],
- },
-]
diff --git a/tests/test_asyncness.rs b/tests/test_asyncness.rs
index 4d7ae7d..8289b3d 100644
--- a/tests/test_asyncness.rs
+++ b/tests/test_asyncness.rs
@@ -9,12 +9,33 @@
#[test]
fn test_async_fn() {
- let code = "async fn process() {}";
- snapshot!(code as Item);
+ let input = "async fn process() {}";
+
+ snapshot!(input as Item, @r###"
+ ⋮Item::Fn {
+ ⋮ vis: Inherited,
+ ⋮ asyncness: Some,
+ ⋮ ident: "process",
+ ⋮ decl: FnDecl {
+ ⋮ generics: Generics,
+ ⋮ output: Default,
+ ⋮ },
+ ⋮ block: Block,
+ ⋮}
+ "###);
}
#[test]
fn test_async_closure() {
- let code = "async || {}";
- snapshot!(code as Expr);
+ let input = "async || {}";
+
+ snapshot!(input as Expr, @r###"
+ ⋮Expr::Closure {
+ ⋮ asyncness: Some,
+ ⋮ output: Default,
+ ⋮ body: Expr::Block {
+ ⋮ block: Block,
+ ⋮ },
+ ⋮}
+ "###);
}
diff --git a/tests/test_attribute.rs b/tests/test_attribute.rs
index ab21544..2a7e106 100644
--- a/tests/test_attribute.rs
+++ b/tests/test_attribute.rs
@@ -6,62 +6,274 @@
mod macros;
use syn::parse::Parser;
-use syn::Attribute;
+use syn::{Attribute, Meta};
#[test]
fn test_meta_item_word() {
- test("#[foo]")
+ let (interpret, parse) = test("#[foo]");
+
+ snapshot!(interpret, @r###"Word("foo")"###);
+
+ snapshot!(parse, @r###"Word("foo")"###);
}
#[test]
fn test_meta_item_name_value() {
- test("#[foo = 5]")
+ let (interpret, parse) = test("#[foo = 5]");
+
+ snapshot!(interpret, @r###"
+ ⋮Meta::NameValue {
+ ⋮ ident: "foo",
+ ⋮ lit: 5,
+ ⋮}
+ "###);
+
+ snapshot!(parse, @r###"
+ ⋮Meta::NameValue {
+ ⋮ ident: "foo",
+ ⋮ lit: 5,
+ ⋮}
+ "###);
}
#[test]
fn test_meta_item_bool_value() {
- test("#[foo = true]");
- test("#[foo = false]")
+ let (interpret, parse) = test("#[foo = true]");;
+
+ snapshot!(interpret, @r###"
+ ⋮Meta::NameValue {
+ ⋮ ident: "foo",
+ ⋮ lit: Lit::Bool {
+ ⋮ value: true,
+ ⋮ },
+ ⋮}
+ "###);
+
+ snapshot!(parse, @r###"
+ ⋮Meta::NameValue {
+ ⋮ ident: "foo",
+ ⋮ lit: Lit::Bool {
+ ⋮ value: true,
+ ⋮ },
+ ⋮}
+ "###);
+
+ let (interpret, parse) = test("#[foo = false]");
+
+ snapshot!(interpret, @r###"
+ ⋮Meta::NameValue {
+ ⋮ ident: "foo",
+ ⋮ lit: Lit::Bool {
+ ⋮ value: false,
+ ⋮ },
+ ⋮}
+ "###);
+
+ snapshot!(parse, @r###"
+ ⋮Meta::NameValue {
+ ⋮ ident: "foo",
+ ⋮ lit: Lit::Bool {
+ ⋮ value: false,
+ ⋮ },
+ ⋮}
+ "###);
}
#[test]
fn test_meta_item_list_lit() {
- test("#[foo(5)]")
+ let (interpret, parse) = test("#[foo(5)]");
+
+ snapshot!(interpret, @r###"
+ ⋮Meta::List {
+ ⋮ ident: "foo",
+ ⋮ nested: [
+ ⋮ Literal(5),
+ ⋮ ],
+ ⋮}
+ "###);
+
+ snapshot!(parse, @r###"
+ ⋮Meta::List {
+ ⋮ ident: "foo",
+ ⋮ nested: [
+ ⋮ Literal(5),
+ ⋮ ],
+ ⋮}
+ "###);
}
#[test]
fn test_meta_item_list_word() {
- test("#[foo(bar)]")
+ let (interpret, parse) = test("#[foo(bar)]");
+
+ snapshot!(interpret, @r###"
+ ⋮Meta::List {
+ ⋮ ident: "foo",
+ ⋮ nested: [
+ ⋮ Meta(Word("bar")),
+ ⋮ ],
+ ⋮}
+ "###);
+
+ snapshot!(parse, @r###"
+ ⋮Meta::List {
+ ⋮ ident: "foo",
+ ⋮ nested: [
+ ⋮ Meta(Word("bar")),
+ ⋮ ],
+ ⋮}
+ "###);
}
#[test]
fn test_meta_item_list_name_value() {
- test("#[foo(bar = 5)]")
+ let (interpret, parse) = test("#[foo(bar = 5)]");
+
+ snapshot!(interpret, @r###"
+ ⋮Meta::List {
+ ⋮ ident: "foo",
+ ⋮ nested: [
+ ⋮ Meta(Meta::NameValue {
+ ⋮ ident: "bar",
+ ⋮ lit: 5,
+ ⋮ }),
+ ⋮ ],
+ ⋮}
+ "###);
+
+ snapshot!(parse, @r###"
+ ⋮Meta::List {
+ ⋮ ident: "foo",
+ ⋮ nested: [
+ ⋮ Meta(Meta::NameValue {
+ ⋮ ident: "bar",
+ ⋮ lit: 5,
+ ⋮ }),
+ ⋮ ],
+ ⋮}
+ "###);
}
#[test]
fn test_meta_item_list_bool_value() {
- test("#[foo(bar = true)]")
+ let (interpret, parse) = test("#[foo(bar = true)]");
+
+ snapshot!(interpret, @r###"
+ ⋮Meta::List {
+ ⋮ ident: "foo",
+ ⋮ nested: [
+ ⋮ Meta(Meta::NameValue {
+ ⋮ ident: "bar",
+ ⋮ lit: Lit::Bool {
+ ⋮ value: true,
+ ⋮ },
+ ⋮ }),
+ ⋮ ],
+ ⋮}
+ "###);
+
+ snapshot!(parse, @r###"
+ ⋮Meta::List {
+ ⋮ ident: "foo",
+ ⋮ nested: [
+ ⋮ Meta(Meta::NameValue {
+ ⋮ ident: "bar",
+ ⋮ lit: Lit::Bool {
+ ⋮ value: true,
+ ⋮ },
+ ⋮ }),
+ ⋮ ],
+ ⋮}
+ "###);
}
#[test]
fn test_meta_item_multiple() {
- test("#[foo(word, name = 5, list(name2 = 6), word2)]")
+ let (interpret, parse) = test("#[foo(word, name = 5, list(name2 = 6), word2)]");
+
+ snapshot!(interpret, @r###"
+ ⋮Meta::List {
+ ⋮ ident: "foo",
+ ⋮ nested: [
+ ⋮ Meta(Word("word")),
+ ⋮ Meta(Meta::NameValue {
+ ⋮ ident: "name",
+ ⋮ lit: 5,
+ ⋮ }),
+ ⋮ Meta(Meta::List {
+ ⋮ ident: "list",
+ ⋮ nested: [
+ ⋮ Meta(Meta::NameValue {
+ ⋮ ident: "name2",
+ ⋮ lit: 6,
+ ⋮ }),
+ ⋮ ],
+ ⋮ }),
+ ⋮ Meta(Word("word2")),
+ ⋮ ],
+ ⋮}
+ "###);
+
+ snapshot!(parse, @r###"
+ ⋮Meta::List {
+ ⋮ ident: "foo",
+ ⋮ nested: [
+ ⋮ Meta(Word("word")),
+ ⋮ Meta(Meta::NameValue {
+ ⋮ ident: "name",
+ ⋮ lit: 5,
+ ⋮ }),
+ ⋮ Meta(Meta::List {
+ ⋮ ident: "list",
+ ⋮ nested: [
+ ⋮ Meta(Meta::NameValue {
+ ⋮ ident: "name2",
+ ⋮ lit: 6,
+ ⋮ }),
+ ⋮ ],
+ ⋮ }),
+ ⋮ Meta(Word("word2")),
+ ⋮ ],
+ ⋮}
+ "###);
}
#[test]
fn test_bool_lit() {
- test("#[foo(true)]")
+ let (interpret, parse) = test("#[foo(true)]");
+
+ snapshot!(interpret, @r###"
+ ⋮Meta::List {
+ ⋮ ident: "foo",
+ ⋮ nested: [
+ ⋮ Literal(Lit::Bool {
+ ⋮ value: true,
+ ⋮ }),
+ ⋮ ],
+ ⋮}
+ "###);
+
+ snapshot!(parse, @r###"
+ ⋮Meta::List {
+ ⋮ ident: "foo",
+ ⋮ nested: [
+ ⋮ Literal(Lit::Bool {
+ ⋮ value: true,
+ ⋮ }),
+ ⋮ ],
+ ⋮}
+ "###);
}
-fn test(input: &str) {
+fn test(input: &str) -> (Meta, Meta) {
let attrs = Attribute::parse_outer.parse_str(input).unwrap();
assert_eq!(attrs.len(), 1);
-
let attr = attrs.into_iter().next().unwrap();
- let interpret = snapshot!(attr.interpret_meta().unwrap());
- let parse = snapshot!(attr.parse_meta().unwrap());
+ let interpret = attr.interpret_meta().unwrap();
+ let parse = attr.parse_meta().unwrap();
assert_eq!(interpret, parse);
+
+ (interpret, parse)
}
diff --git a/tests/test_derive_input.rs b/tests/test_derive_input.rs
index dc1b872..112caee 100644
--- a/tests/test_derive_input.rs
+++ b/tests/test_derive_input.rs
@@ -11,16 +11,26 @@
#[test]
fn test_unit() {
- let code = quote! {
+ let input = quote! {
struct Unit;
};
- snapshot!(code as DeriveInput);
+ snapshot!(input as DeriveInput, @r###"
+ ⋮DeriveInput {
+ ⋮ vis: Inherited,
+ ⋮ ident: "Unit",
+ ⋮ generics: Generics,
+ ⋮ data: Data::Struct {
+ ⋮ fields: Unit,
+ ⋮ semi_token: Some,
+ ⋮ },
+ ⋮}
+ "###);
}
#[test]
fn test_struct() {
- let code = quote! {
+ let input = quote! {
#[derive(Debug, Clone)]
pub struct Item {
pub ident: Ident,
@@ -28,27 +38,145 @@
}
};
- let actual = snapshot!(code as DeriveInput);
+ snapshot!(input as DeriveInput, @r###"
+ ⋮DeriveInput {
+ ⋮ attrs: [
+ ⋮ Attribute {
+ ⋮ style: Outer,
+ ⋮ path: Path {
+ ⋮ segments: [
+ ⋮ PathSegment {
+ ⋮ ident: "derive",
+ ⋮ arguments: None,
+ ⋮ },
+ ⋮ ],
+ ⋮ },
+ ⋮ tts: `( Debug , Clone )`,
+ ⋮ },
+ ⋮ ],
+ ⋮ vis: Visibility::Public,
+ ⋮ ident: "Item",
+ ⋮ generics: Generics,
+ ⋮ data: Data::Struct {
+ ⋮ fields: Fields::Named {
+ ⋮ named: [
+ ⋮ Field {
+ ⋮ vis: Visibility::Public,
+ ⋮ ident: Some("ident"),
+ ⋮ colon_token: Some,
+ ⋮ ty: Type::Path {
+ ⋮ path: Path {
+ ⋮ segments: [
+ ⋮ PathSegment {
+ ⋮ ident: "Ident",
+ ⋮ arguments: None,
+ ⋮ },
+ ⋮ ],
+ ⋮ },
+ ⋮ },
+ ⋮ },
+ ⋮ Field {
+ ⋮ vis: Visibility::Public,
+ ⋮ ident: Some("attrs"),
+ ⋮ colon_token: Some,
+ ⋮ ty: Type::Path {
+ ⋮ path: Path {
+ ⋮ segments: [
+ ⋮ PathSegment {
+ ⋮ ident: "Vec",
+ ⋮ arguments: PathArguments::AngleBracketed {
+ ⋮ args: [
+ ⋮ Type(Type::Path {
+ ⋮ path: Path {
+ ⋮ segments: [
+ ⋮ PathSegment {
+ ⋮ ident: "Attribute",
+ ⋮ arguments: None,
+ ⋮ },
+ ⋮ ],
+ ⋮ },
+ ⋮ }),
+ ⋮ ],
+ ⋮ },
+ ⋮ },
+ ⋮ ],
+ ⋮ },
+ ⋮ },
+ ⋮ },
+ ⋮ ],
+ ⋮ },
+ ⋮ },
+ ⋮}
+ "###);
- snapshot!(actual.attrs[0].interpret_meta().unwrap());
+ snapshot!(input.attrs[0].interpret_meta().unwrap(), @r###"
+ ⋮Meta::List {
+ ⋮ ident: "derive",
+ ⋮ nested: [
+ ⋮ Meta(Word("Debug")),
+ ⋮ Meta(Word("Clone")),
+ ⋮ ],
+ ⋮}
+ "###);
}
#[test]
fn test_union() {
- let code = quote! {
+ let input = quote! {
union MaybeUninit<T> {
uninit: (),
value: T
}
};
- snapshot!(code as DeriveInput);
+ snapshot!(input as DeriveInput, @r###"
+ ⋮DeriveInput {
+ ⋮ vis: Inherited,
+ ⋮ ident: "MaybeUninit",
+ ⋮ generics: Generics {
+ ⋮ lt_token: Some,
+ ⋮ params: [
+ ⋮ Type(TypeParam {
+ ⋮ ident: "T",
+ ⋮ }),
+ ⋮ ],
+ ⋮ gt_token: Some,
+ ⋮ },
+ ⋮ data: Data::Union {
+ ⋮ fields: FieldsNamed {
+ ⋮ named: [
+ ⋮ Field {
+ ⋮ vis: Inherited,
+ ⋮ ident: Some("uninit"),
+ ⋮ colon_token: Some,
+ ⋮ ty: Type::Tuple,
+ ⋮ },
+ ⋮ Field {
+ ⋮ vis: Inherited,
+ ⋮ ident: Some("value"),
+ ⋮ colon_token: Some,
+ ⋮ ty: Type::Path {
+ ⋮ path: Path {
+ ⋮ segments: [
+ ⋮ PathSegment {
+ ⋮ ident: "T",
+ ⋮ arguments: None,
+ ⋮ },
+ ⋮ ],
+ ⋮ },
+ ⋮ },
+ ⋮ },
+ ⋮ ],
+ ⋮ },
+ ⋮ },
+ ⋮}
+ "###);
}
#[test]
#[cfg(feature = "full")]
fn test_enum() {
- let code = quote! {
+ let input = quote! {
/// See the std::result module documentation for details.
#[must_use]
pub enum Result<T, E> {
@@ -62,157 +190,660 @@
}
};
- let actual = snapshot!(code as DeriveInput);
+ snapshot!(input as DeriveInput, @r###"
+ ⋮DeriveInput {
+ ⋮ attrs: [
+ ⋮ Attribute {
+ ⋮ style: Outer,
+ ⋮ path: Path {
+ ⋮ segments: [
+ ⋮ PathSegment {
+ ⋮ ident: "doc",
+ ⋮ arguments: None,
+ ⋮ },
+ ⋮ ],
+ ⋮ },
+ ⋮ tts: `= r" See the std::result module documentation for details."`,
+ ⋮ },
+ ⋮ Attribute {
+ ⋮ style: Outer,
+ ⋮ path: Path {
+ ⋮ segments: [
+ ⋮ PathSegment {
+ ⋮ ident: "must_use",
+ ⋮ arguments: None,
+ ⋮ },
+ ⋮ ],
+ ⋮ },
+ ⋮ tts: ``,
+ ⋮ },
+ ⋮ ],
+ ⋮ vis: Visibility::Public,
+ ⋮ ident: "Result",
+ ⋮ generics: Generics {
+ ⋮ lt_token: Some,
+ ⋮ params: [
+ ⋮ Type(TypeParam {
+ ⋮ ident: "T",
+ ⋮ }),
+ ⋮ Type(TypeParam {
+ ⋮ ident: "E",
+ ⋮ }),
+ ⋮ ],
+ ⋮ gt_token: Some,
+ ⋮ },
+ ⋮ data: Data::Enum {
+ ⋮ variants: [
+ ⋮ Variant {
+ ⋮ ident: "Ok",
+ ⋮ fields: Fields::Unnamed {
+ ⋮ unnamed: [
+ ⋮ Field {
+ ⋮ vis: Inherited,
+ ⋮ ty: Type::Path {
+ ⋮ path: Path {
+ ⋮ segments: [
+ ⋮ PathSegment {
+ ⋮ ident: "T",
+ ⋮ arguments: None,
+ ⋮ },
+ ⋮ ],
+ ⋮ },
+ ⋮ },
+ ⋮ },
+ ⋮ ],
+ ⋮ },
+ ⋮ },
+ ⋮ Variant {
+ ⋮ ident: "Err",
+ ⋮ fields: Fields::Unnamed {
+ ⋮ unnamed: [
+ ⋮ Field {
+ ⋮ vis: Inherited,
+ ⋮ ty: Type::Path {
+ ⋮ path: Path {
+ ⋮ segments: [
+ ⋮ PathSegment {
+ ⋮ ident: "E",
+ ⋮ arguments: None,
+ ⋮ },
+ ⋮ ],
+ ⋮ },
+ ⋮ },
+ ⋮ },
+ ⋮ ],
+ ⋮ },
+ ⋮ },
+ ⋮ Variant {
+ ⋮ ident: "Surprise",
+ ⋮ fields: Unit,
+ ⋮ discriminant: Some(Expr::Lit {
+ ⋮ lit: 0,
+ ⋮ }),
+ ⋮ },
+ ⋮ Variant {
+ ⋮ ident: "ProcMacroHack",
+ ⋮ fields: Unit,
+ ⋮ discriminant: Some(Expr::Field {
+ ⋮ base: Expr::Tuple {
+ ⋮ elems: [
+ ⋮ Expr::Lit {
+ ⋮ lit: 0,
+ ⋮ },
+ ⋮ Expr::Lit {
+ ⋮ lit: "data",
+ ⋮ },
+ ⋮ ],
+ ⋮ },
+ ⋮ member: Unnamed(Index {
+ ⋮ index: 0,
+ ⋮ }),
+ ⋮ }),
+ ⋮ },
+ ⋮ ],
+ ⋮ },
+ ⋮}
+ "###);
- let meta_items: Vec<_> = actual
+ let meta_items: Vec<_> = input
.attrs
.into_iter()
.map(|attr| attr.interpret_meta().unwrap())
.collect();
- snapshot!(meta_items);
+ snapshot!(meta_items, @r###"
+ ⋮[
+ ⋮ Meta::NameValue {
+ ⋮ ident: "doc",
+ ⋮ lit: " See the std::result module documentation for details.",
+ ⋮ },
+ ⋮ Word("must_use"),
+ ⋮]
+ "###);
}
#[test]
fn test_attr_with_path() {
- let code = quote! {
+ let input = quote! {
#[::attr_args::identity
fn main() { assert_eq!(foo(), "Hello, world!"); }]
struct Dummy;
};
- let actual = snapshot!(code as DeriveInput);
+ snapshot!(input as DeriveInput, @r###"
+ ⋮DeriveInput {
+ ⋮ attrs: [
+ ⋮ Attribute {
+ ⋮ style: Outer,
+ ⋮ path: Path {
+ ⋮ leading_colon: Some,
+ ⋮ segments: [
+ ⋮ PathSegment {
+ ⋮ ident: "attr_args",
+ ⋮ arguments: None,
+ ⋮ },
+ ⋮ PathSegment {
+ ⋮ ident: "identity",
+ ⋮ arguments: None,
+ ⋮ },
+ ⋮ ],
+ ⋮ },
+ ⋮ tts: `fn main ( ) { assert_eq ! ( foo ( ) , "Hello, world!" ) ; }`,
+ ⋮ },
+ ⋮ ],
+ ⋮ vis: Inherited,
+ ⋮ ident: "Dummy",
+ ⋮ generics: Generics,
+ ⋮ data: Data::Struct {
+ ⋮ fields: Unit,
+ ⋮ semi_token: Some,
+ ⋮ },
+ ⋮}
+ "###);
- assert!(actual.attrs[0].interpret_meta().is_none());
+ assert!(input.attrs[0].interpret_meta().is_none());
}
#[test]
fn test_attr_with_non_mod_style_path() {
- let code = quote! {
+ let input = quote! {
#[inert <T>]
struct S;
};
- let actual = snapshot!(code as DeriveInput);
+ snapshot!(input as DeriveInput, @r###"
+ ⋮DeriveInput {
+ ⋮ attrs: [
+ ⋮ Attribute {
+ ⋮ style: Outer,
+ ⋮ path: Path {
+ ⋮ segments: [
+ ⋮ PathSegment {
+ ⋮ ident: "inert",
+ ⋮ arguments: None,
+ ⋮ },
+ ⋮ ],
+ ⋮ },
+ ⋮ tts: `< T >`,
+ ⋮ },
+ ⋮ ],
+ ⋮ vis: Inherited,
+ ⋮ ident: "S",
+ ⋮ generics: Generics,
+ ⋮ data: Data::Struct {
+ ⋮ fields: Unit,
+ ⋮ semi_token: Some,
+ ⋮ },
+ ⋮}
+ "###);
- assert!(actual.attrs[0].interpret_meta().is_none());
+ assert!(input.attrs[0].interpret_meta().is_none());
}
#[test]
fn test_attr_with_mod_style_path_with_self() {
- let code = quote! {
+ let input = quote! {
#[foo::self]
struct S;
};
- let actual = snapshot!(code as DeriveInput);
+ snapshot!(input as DeriveInput, @r###"
+ ⋮DeriveInput {
+ ⋮ attrs: [
+ ⋮ Attribute {
+ ⋮ style: Outer,
+ ⋮ path: Path {
+ ⋮ segments: [
+ ⋮ PathSegment {
+ ⋮ ident: "foo",
+ ⋮ arguments: None,
+ ⋮ },
+ ⋮ PathSegment {
+ ⋮ ident: "self",
+ ⋮ arguments: None,
+ ⋮ },
+ ⋮ ],
+ ⋮ },
+ ⋮ tts: ``,
+ ⋮ },
+ ⋮ ],
+ ⋮ vis: Inherited,
+ ⋮ ident: "S",
+ ⋮ generics: Generics,
+ ⋮ data: Data::Struct {
+ ⋮ fields: Unit,
+ ⋮ semi_token: Some,
+ ⋮ },
+ ⋮}
+ "###);
- assert!(actual.attrs[0].interpret_meta().is_none());
+ assert!(input.attrs[0].interpret_meta().is_none());
}
#[test]
fn test_pub_restricted() {
// Taken from tests/rust/src/test/ui/resolve/auxiliary/privacy-struct-ctor.rs
- let code = quote! {
+ let input = quote! {
pub(in m) struct Z(pub(in m::n) u8);
};
- snapshot!(code as DeriveInput);
+ snapshot!(input as DeriveInput, @r###"
+ ⋮DeriveInput {
+ ⋮ vis: Visibility::Restricted {
+ ⋮ in_token: Some,
+ ⋮ path: Path {
+ ⋮ segments: [
+ ⋮ PathSegment {
+ ⋮ ident: "m",
+ ⋮ arguments: None,
+ ⋮ },
+ ⋮ ],
+ ⋮ },
+ ⋮ },
+ ⋮ ident: "Z",
+ ⋮ generics: Generics,
+ ⋮ data: Data::Struct {
+ ⋮ fields: Fields::Unnamed {
+ ⋮ unnamed: [
+ ⋮ Field {
+ ⋮ vis: Visibility::Restricted {
+ ⋮ in_token: Some,
+ ⋮ path: Path {
+ ⋮ segments: [
+ ⋮ PathSegment {
+ ⋮ ident: "m",
+ ⋮ arguments: None,
+ ⋮ },
+ ⋮ PathSegment {
+ ⋮ ident: "n",
+ ⋮ arguments: None,
+ ⋮ },
+ ⋮ ],
+ ⋮ },
+ ⋮ },
+ ⋮ ty: Type::Path {
+ ⋮ path: Path {
+ ⋮ segments: [
+ ⋮ PathSegment {
+ ⋮ ident: "u8",
+ ⋮ arguments: None,
+ ⋮ },
+ ⋮ ],
+ ⋮ },
+ ⋮ },
+ ⋮ },
+ ⋮ ],
+ ⋮ },
+ ⋮ semi_token: Some,
+ ⋮ },
+ ⋮}
+ "###);
}
#[test]
fn test_vis_crate() {
- let code = quote! {
+ let input = quote! {
crate struct S;
};
- snapshot!(code as DeriveInput);
+ snapshot!(input as DeriveInput, @r###"
+ ⋮DeriveInput {
+ ⋮ vis: Visibility::Crate,
+ ⋮ ident: "S",
+ ⋮ generics: Generics,
+ ⋮ data: Data::Struct {
+ ⋮ fields: Unit,
+ ⋮ semi_token: Some,
+ ⋮ },
+ ⋮}
+ "###);
}
#[test]
fn test_pub_restricted_crate() {
- let code = quote! {
+ let input = quote! {
pub(crate) struct S;
};
- snapshot!(code as DeriveInput);
+ snapshot!(input as DeriveInput, @r###"
+ ⋮DeriveInput {
+ ⋮ vis: Visibility::Restricted {
+ ⋮ path: Path {
+ ⋮ segments: [
+ ⋮ PathSegment {
+ ⋮ ident: "crate",
+ ⋮ arguments: None,
+ ⋮ },
+ ⋮ ],
+ ⋮ },
+ ⋮ },
+ ⋮ ident: "S",
+ ⋮ generics: Generics,
+ ⋮ data: Data::Struct {
+ ⋮ fields: Unit,
+ ⋮ semi_token: Some,
+ ⋮ },
+ ⋮}
+ "###);
}
#[test]
fn test_pub_restricted_super() {
- let code = quote! {
+ let input = quote! {
pub(super) struct S;
};
- snapshot!(code as DeriveInput);
+ snapshot!(input as DeriveInput, @r###"
+ ⋮DeriveInput {
+ ⋮ vis: Visibility::Restricted {
+ ⋮ path: Path {
+ ⋮ segments: [
+ ⋮ PathSegment {
+ ⋮ ident: "super",
+ ⋮ arguments: None,
+ ⋮ },
+ ⋮ ],
+ ⋮ },
+ ⋮ },
+ ⋮ ident: "S",
+ ⋮ generics: Generics,
+ ⋮ data: Data::Struct {
+ ⋮ fields: Unit,
+ ⋮ semi_token: Some,
+ ⋮ },
+ ⋮}
+ "###);
}
#[test]
fn test_pub_restricted_in_super() {
- let code = quote! {
+ let input = quote! {
pub(in super) struct S;
};
- snapshot!(code as DeriveInput);
+ snapshot!(input as DeriveInput, @r###"
+ ⋮DeriveInput {
+ ⋮ vis: Visibility::Restricted {
+ ⋮ in_token: Some,
+ ⋮ path: Path {
+ ⋮ segments: [
+ ⋮ PathSegment {
+ ⋮ ident: "super",
+ ⋮ arguments: None,
+ ⋮ },
+ ⋮ ],
+ ⋮ },
+ ⋮ },
+ ⋮ ident: "S",
+ ⋮ generics: Generics,
+ ⋮ data: Data::Struct {
+ ⋮ fields: Unit,
+ ⋮ semi_token: Some,
+ ⋮ },
+ ⋮}
+ "###);
}
#[test]
fn test_fields_on_unit_struct() {
- let code = quote! {
+ let input = quote! {
struct S;
};
- let actual = snapshot!(code as DeriveInput);
+ snapshot!(input as DeriveInput, @r###"
+ ⋮DeriveInput {
+ ⋮ vis: Inherited,
+ ⋮ ident: "S",
+ ⋮ generics: Generics,
+ ⋮ data: Data::Struct {
+ ⋮ fields: Unit,
+ ⋮ semi_token: Some,
+ ⋮ },
+ ⋮}
+ "###);
- match actual.data {
- Data::Struct(data) => {
- assert_eq!(0, data.fields.iter().count());
- }
+ let data = match input.data {
+ Data::Struct(data) => data,
_ => panic!("expected a struct"),
- }
+ };
+
+ assert_eq!(0, data.fields.iter().count());
}
#[test]
fn test_fields_on_named_struct() {
- let code = quote! {
+ let input = quote! {
struct S {
foo: i32,
pub bar: String,
}
};
- let actual = snapshot!(code as DeriveInput);
+ snapshot!(input as DeriveInput, @r###"
+ ⋮DeriveInput {
+ ⋮ vis: Inherited,
+ ⋮ ident: "S",
+ ⋮ generics: Generics,
+ ⋮ data: Data::Struct {
+ ⋮ fields: Fields::Named {
+ ⋮ named: [
+ ⋮ Field {
+ ⋮ vis: Inherited,
+ ⋮ ident: Some("foo"),
+ ⋮ colon_token: Some,
+ ⋮ ty: Type::Path {
+ ⋮ path: Path {
+ ⋮ segments: [
+ ⋮ PathSegment {
+ ⋮ ident: "i32",
+ ⋮ arguments: None,
+ ⋮ },
+ ⋮ ],
+ ⋮ },
+ ⋮ },
+ ⋮ },
+ ⋮ Field {
+ ⋮ vis: Visibility::Public,
+ ⋮ ident: Some("bar"),
+ ⋮ colon_token: Some,
+ ⋮ ty: Type::Path {
+ ⋮ path: Path {
+ ⋮ segments: [
+ ⋮ PathSegment {
+ ⋮ ident: "String",
+ ⋮ arguments: None,
+ ⋮ },
+ ⋮ ],
+ ⋮ },
+ ⋮ },
+ ⋮ },
+ ⋮ ],
+ ⋮ },
+ ⋮ },
+ ⋮}
+ "###);
- match actual.data {
- Data::Struct(data) => {
- snapshot!(data.fields.iter().collect::<Vec<_>>());
- }
+ let data = match input.data {
+ Data::Struct(data) => data,
_ => panic!("expected a struct"),
- }
+ };
+
+ snapshot!(data.fields.into_iter().collect::<Vec<_>>(), @r###"
+ ⋮[
+ ⋮ Field {
+ ⋮ vis: Inherited,
+ ⋮ ident: Some("foo"),
+ ⋮ colon_token: Some,
+ ⋮ ty: Type::Path {
+ ⋮ path: Path {
+ ⋮ segments: [
+ ⋮ PathSegment {
+ ⋮ ident: "i32",
+ ⋮ arguments: None,
+ ⋮ },
+ ⋮ ],
+ ⋮ },
+ ⋮ },
+ ⋮ },
+ ⋮ Field {
+ ⋮ vis: Visibility::Public,
+ ⋮ ident: Some("bar"),
+ ⋮ colon_token: Some,
+ ⋮ ty: Type::Path {
+ ⋮ path: Path {
+ ⋮ segments: [
+ ⋮ PathSegment {
+ ⋮ ident: "String",
+ ⋮ arguments: None,
+ ⋮ },
+ ⋮ ],
+ ⋮ },
+ ⋮ },
+ ⋮ },
+ ⋮]
+ "###);
}
#[test]
fn test_fields_on_tuple_struct() {
- let code = quote! {
+ let input = quote! {
struct S(i32, pub String);
};
- let actual = snapshot!(code as DeriveInput);
+ snapshot!(input as DeriveInput, @r###"
+ ⋮DeriveInput {
+ ⋮ vis: Inherited,
+ ⋮ ident: "S",
+ ⋮ generics: Generics,
+ ⋮ data: Data::Struct {
+ ⋮ fields: Fields::Unnamed {
+ ⋮ unnamed: [
+ ⋮ Field {
+ ⋮ vis: Inherited,
+ ⋮ ty: Type::Path {
+ ⋮ path: Path {
+ ⋮ segments: [
+ ⋮ PathSegment {
+ ⋮ ident: "i32",
+ ⋮ arguments: None,
+ ⋮ },
+ ⋮ ],
+ ⋮ },
+ ⋮ },
+ ⋮ },
+ ⋮ Field {
+ ⋮ vis: Visibility::Public,
+ ⋮ ty: Type::Path {
+ ⋮ path: Path {
+ ⋮ segments: [
+ ⋮ PathSegment {
+ ⋮ ident: "String",
+ ⋮ arguments: None,
+ ⋮ },
+ ⋮ ],
+ ⋮ },
+ ⋮ },
+ ⋮ },
+ ⋮ ],
+ ⋮ },
+ ⋮ semi_token: Some,
+ ⋮ },
+ ⋮}
+ "###);
- match actual.data {
- Data::Struct(data) => {
- snapshot!(data.fields.iter().collect::<Vec<_>>());
- }
+ let data = match input.data {
+ Data::Struct(data) => data,
_ => panic!("expected a struct"),
- }
+ };
+
+ snapshot!(data.fields.iter().collect::<Vec<_>>(), @r###"
+ ⋮[
+ ⋮ Field {
+ ⋮ vis: Inherited,
+ ⋮ ty: Type::Path {
+ ⋮ path: Path {
+ ⋮ segments: [
+ ⋮ PathSegment {
+ ⋮ ident: "i32",
+ ⋮ arguments: None,
+ ⋮ },
+ ⋮ ],
+ ⋮ },
+ ⋮ },
+ ⋮ },
+ ⋮ Field {
+ ⋮ vis: Visibility::Public,
+ ⋮ ty: Type::Path {
+ ⋮ path: Path {
+ ⋮ segments: [
+ ⋮ PathSegment {
+ ⋮ ident: "String",
+ ⋮ arguments: None,
+ ⋮ },
+ ⋮ ],
+ ⋮ },
+ ⋮ },
+ ⋮ },
+ ⋮]
+ "###);
}
#[test]
fn test_ambiguous_crate() {
- let code = quote! {
+ let input = quote! {
// The field type is `(crate::X)` not `crate (::X)`.
struct S(crate::X);
};
- snapshot!(code as DeriveInput);
+ snapshot!(input as DeriveInput, @r###"
+ ⋮DeriveInput {
+ ⋮ vis: Inherited,
+ ⋮ ident: "S",
+ ⋮ generics: Generics,
+ ⋮ data: Data::Struct {
+ ⋮ fields: Fields::Unnamed {
+ ⋮ unnamed: [
+ ⋮ Field {
+ ⋮ vis: Inherited,
+ ⋮ ty: Type::Path {
+ ⋮ path: Path {
+ ⋮ segments: [
+ ⋮ PathSegment {
+ ⋮ ident: "crate",
+ ⋮ arguments: None,
+ ⋮ },
+ ⋮ PathSegment {
+ ⋮ ident: "X",
+ ⋮ arguments: None,
+ ⋮ },
+ ⋮ ],
+ ⋮ },
+ ⋮ },
+ ⋮ },
+ ⋮ ],
+ ⋮ },
+ ⋮ semi_token: Some,
+ ⋮ },
+ ⋮}
+ "###);
}
diff --git a/tests/test_generics.rs b/tests/test_generics.rs
index 112215a..27b204e 100644
--- a/tests/test_generics.rs
+++ b/tests/test_generics.rs
@@ -11,13 +11,98 @@
#[test]
fn test_split_for_impl() {
- let code = quote! {
+ let input = quote! {
struct S<'a, 'b: 'a, #[may_dangle] T: 'a = ()> where T: Debug;
};
- let actual = snapshot!(code as DeriveInput);
+ snapshot!(input as DeriveInput, @r###"
+ ⋮DeriveInput {
+ ⋮ vis: Inherited,
+ ⋮ ident: "S",
+ ⋮ generics: Generics {
+ ⋮ lt_token: Some,
+ ⋮ params: [
+ ⋮ Lifetime(LifetimeDef {
+ ⋮ lifetime: Lifetime {
+ ⋮ ident: "a",
+ ⋮ },
+ ⋮ }),
+ ⋮ Lifetime(LifetimeDef {
+ ⋮ lifetime: Lifetime {
+ ⋮ ident: "b",
+ ⋮ },
+ ⋮ colon_token: Some,
+ ⋮ bounds: [
+ ⋮ Lifetime {
+ ⋮ ident: "a",
+ ⋮ },
+ ⋮ ],
+ ⋮ }),
+ ⋮ Type(TypeParam {
+ ⋮ attrs: [
+ ⋮ Attribute {
+ ⋮ style: Outer,
+ ⋮ path: Path {
+ ⋮ segments: [
+ ⋮ PathSegment {
+ ⋮ ident: "may_dangle",
+ ⋮ arguments: None,
+ ⋮ },
+ ⋮ ],
+ ⋮ },
+ ⋮ tts: ``,
+ ⋮ },
+ ⋮ ],
+ ⋮ ident: "T",
+ ⋮ colon_token: Some,
+ ⋮ bounds: [
+ ⋮ Lifetime(Lifetime {
+ ⋮ ident: "a",
+ ⋮ }),
+ ⋮ ],
+ ⋮ eq_token: Some,
+ ⋮ default: Some(Type::Tuple),
+ ⋮ }),
+ ⋮ ],
+ ⋮ gt_token: Some,
+ ⋮ where_clause: Some(WhereClause {
+ ⋮ predicates: [
+ ⋮ Type(PredicateType {
+ ⋮ bounded_ty: Type::Path {
+ ⋮ path: Path {
+ ⋮ segments: [
+ ⋮ PathSegment {
+ ⋮ ident: "T",
+ ⋮ arguments: None,
+ ⋮ },
+ ⋮ ],
+ ⋮ },
+ ⋮ },
+ ⋮ bounds: [
+ ⋮ Trait(TraitBound {
+ ⋮ modifier: None,
+ ⋮ path: Path {
+ ⋮ segments: [
+ ⋮ PathSegment {
+ ⋮ ident: "Debug",
+ ⋮ arguments: None,
+ ⋮ },
+ ⋮ ],
+ ⋮ },
+ ⋮ }),
+ ⋮ ],
+ ⋮ }),
+ ⋮ ],
+ ⋮ }),
+ ⋮ },
+ ⋮ data: Data::Struct {
+ ⋮ fields: Unit,
+ ⋮ semi_token: Some,
+ ⋮ },
+ ⋮}
+ "###);
- let generics = actual.generics;
+ let generics = input.generics;
let (impl_generics, ty_generics, where_clause) = generics.split_for_impl();
let generated = quote! {
@@ -45,23 +130,55 @@
#[test]
fn test_ty_param_bound() {
let tokens = quote!('a);
- snapshot!(tokens as TypeParamBound);
+ snapshot!(tokens as TypeParamBound, @r###"
+ ⋮Lifetime(Lifetime {
+ ⋮ ident: "a",
+ ⋮})
+ "###);
let tokens = quote!('_);
- snapshot!(tokens as TypeParamBound);
+ snapshot!(tokens as TypeParamBound, @r###"
+ ⋮Lifetime(Lifetime {
+ ⋮ ident: "_",
+ ⋮})
+ "###);
let tokens = quote!(Debug);
- snapshot!(tokens as TypeParamBound);
+ snapshot!(tokens as TypeParamBound, @r###"
+ ⋮Trait(TraitBound {
+ ⋮ modifier: None,
+ ⋮ path: Path {
+ ⋮ segments: [
+ ⋮ PathSegment {
+ ⋮ ident: "Debug",
+ ⋮ arguments: None,
+ ⋮ },
+ ⋮ ],
+ ⋮ },
+ ⋮})
+ "###);
let tokens = quote!(?Sized);
- snapshot!(tokens as TypeParamBound);
+ snapshot!(tokens as TypeParamBound, @r###"
+ ⋮Trait(TraitBound {
+ ⋮ modifier: Maybe,
+ ⋮ path: Path {
+ ⋮ segments: [
+ ⋮ PathSegment {
+ ⋮ ident: "Sized",
+ ⋮ arguments: None,
+ ⋮ },
+ ⋮ ],
+ ⋮ },
+ ⋮})
+ "###);
}
#[test]
fn test_fn_precedence_in_where_clause() {
// This should parse as two separate bounds, `FnOnce() -> i32` and `Send` - not
// `FnOnce() -> (i32 + Send)`.
- let code = quote! {
+ let input = quote! {
fn f<G>()
where
G: FnOnce() -> i32 + Send,
@@ -69,9 +186,80 @@
}
};
- let actual = snapshot!(code as ItemFn);
+ snapshot!(input as ItemFn, @r###"
+ ⋮ItemFn {
+ ⋮ vis: Inherited,
+ ⋮ ident: "f",
+ ⋮ decl: FnDecl {
+ ⋮ generics: Generics {
+ ⋮ lt_token: Some,
+ ⋮ params: [
+ ⋮ Type(TypeParam {
+ ⋮ ident: "G",
+ ⋮ }),
+ ⋮ ],
+ ⋮ gt_token: Some,
+ ⋮ where_clause: Some(WhereClause {
+ ⋮ predicates: [
+ ⋮ Type(PredicateType {
+ ⋮ bounded_ty: Type::Path {
+ ⋮ path: Path {
+ ⋮ segments: [
+ ⋮ PathSegment {
+ ⋮ ident: "G",
+ ⋮ arguments: None,
+ ⋮ },
+ ⋮ ],
+ ⋮ },
+ ⋮ },
+ ⋮ bounds: [
+ ⋮ Trait(TraitBound {
+ ⋮ modifier: None,
+ ⋮ path: Path {
+ ⋮ segments: [
+ ⋮ PathSegment {
+ ⋮ ident: "FnOnce",
+ ⋮ arguments: PathArguments::Parenthesized {
+ ⋮ output: Type(
+ ⋮ Type::Path {
+ ⋮ path: Path {
+ ⋮ segments: [
+ ⋮ PathSegment {
+ ⋮ ident: "i32",
+ ⋮ arguments: None,
+ ⋮ },
+ ⋮ ],
+ ⋮ },
+ ⋮ },
+ ⋮ ),
+ ⋮ },
+ ⋮ },
+ ⋮ ],
+ ⋮ },
+ ⋮ }),
+ ⋮ Trait(TraitBound {
+ ⋮ modifier: None,
+ ⋮ path: Path {
+ ⋮ segments: [
+ ⋮ PathSegment {
+ ⋮ ident: "Send",
+ ⋮ arguments: None,
+ ⋮ },
+ ⋮ ],
+ ⋮ },
+ ⋮ }),
+ ⋮ ],
+ ⋮ }),
+ ⋮ ],
+ ⋮ }),
+ ⋮ },
+ ⋮ output: Default,
+ ⋮ },
+ ⋮ block: Block,
+ ⋮}
+ "###);
- let where_clause = actual.decl.generics.where_clause.as_ref().unwrap();
+ let where_clause = input.decl.generics.where_clause.as_ref().unwrap();
assert_eq!(where_clause.predicates.len(), 1);
let predicate = match &where_clause.predicates[0] {
@@ -90,10 +278,11 @@
#[test]
fn test_where_clause_at_end_of_input() {
- let tokens = quote! {
+ let input = quote! {
where
};
- let where_clause = snapshot!(tokens as WhereClause);
- assert_eq!(where_clause.predicates.len(), 0);
+ snapshot!(input as WhereClause, @"WhereClause");
+
+ assert_eq!(input.predicates.len(), 0);
}
diff --git a/tests/test_grouping.rs b/tests/test_grouping.rs
index df309ad..6ca438d 100644
--- a/tests/test_grouping.rs
+++ b/tests/test_grouping.rs
@@ -30,5 +30,29 @@
assert_eq!(tokens.to_string(), "1i32 + 2i32 + 3i32 * 4i32");
- snapshot!(tokens as Expr);
+ snapshot!(tokens as Expr, @r###"
+ ⋮Expr::Binary {
+ ⋮ left: Expr::Lit {
+ ⋮ lit: 1,
+ ⋮ },
+ ⋮ op: Add,
+ ⋮ right: Expr::Binary {
+ ⋮ left: Expr::Group {
+ ⋮ expr: Expr::Binary {
+ ⋮ left: Expr::Lit {
+ ⋮ lit: 2,
+ ⋮ },
+ ⋮ op: Add,
+ ⋮ right: Expr::Lit {
+ ⋮ lit: 3,
+ ⋮ },
+ ⋮ },
+ ⋮ },
+ ⋮ op: Mul,
+ ⋮ right: Expr::Lit {
+ ⋮ lit: 4,
+ ⋮ },
+ ⋮ },
+ ⋮}
+ "###);
}
diff --git a/tests/test_meta.rs b/tests/test_meta.rs
index 5a8cba7..97639cf 100644
--- a/tests/test_meta.rs
+++ b/tests/test_meta.rs
@@ -5,57 +5,176 @@
#[macro_use]
mod macros;
-use std::fmt::Debug;
-use syn::parse::Parse;
use syn::{Meta, MetaList, MetaNameValue, NestedMeta};
#[test]
fn test_parse_meta_item_word() {
- let code = "hello";
+ let input = "hello";
- snapshot!(code as Meta);
+ snapshot!(input as Meta, @r###"Word("hello")"###);
}
#[test]
fn test_parse_meta_name_value() {
- test::<MetaNameValue>("foo = 5");
+ let input = "foo = 5";
+ let (inner, meta) = (input, input);
+
+ snapshot!(inner as MetaNameValue, @r###"
+ ⋮MetaNameValue {
+ ⋮ ident: "foo",
+ ⋮ lit: 5,
+ ⋮}
+ "###);
+
+ snapshot!(meta as Meta, @r###"
+ ⋮Meta::NameValue {
+ ⋮ ident: "foo",
+ ⋮ lit: 5,
+ ⋮}
+ "###);
+
+ assert_eq!(meta, inner.into());
}
#[test]
fn test_parse_meta_name_value_with_keyword() {
- test::<MetaNameValue>("static = 5");
+ let input = "static = 5";
+ let (inner, meta) = (input, input);
+
+ snapshot!(inner as MetaNameValue, @r###"
+ ⋮MetaNameValue {
+ ⋮ ident: "static",
+ ⋮ lit: 5,
+ ⋮}
+ "###);
+
+ snapshot!(meta as Meta, @r###"
+ ⋮Meta::NameValue {
+ ⋮ ident: "static",
+ ⋮ lit: 5,
+ ⋮}
+ "###);
+
+ assert_eq!(meta, inner.into());
}
#[test]
fn test_parse_meta_name_value_with_bool() {
- test::<MetaNameValue>("true = 5");
+ let input = "true = 5";
+ let (inner, meta) = (input, input);
+
+ snapshot!(inner as MetaNameValue, @r###"
+ ⋮MetaNameValue {
+ ⋮ ident: "true",
+ ⋮ lit: 5,
+ ⋮}
+ "###);
+
+ snapshot!(meta as Meta, @r###"
+ ⋮Meta::NameValue {
+ ⋮ ident: "true",
+ ⋮ lit: 5,
+ ⋮}
+ "###);
+
+ assert_eq!(meta, inner.into());
}
#[test]
fn test_parse_meta_item_list_lit() {
- test::<MetaList>("foo(5)");
+ let input = "foo(5)";
+ let (inner, meta) = (input, input);
+
+ snapshot!(inner as MetaList, @r###"
+ ⋮MetaList {
+ ⋮ ident: "foo",
+ ⋮ nested: [
+ ⋮ Literal(5),
+ ⋮ ],
+ ⋮}
+ "###);
+
+ snapshot!(meta as Meta, @r###"
+ ⋮Meta::List {
+ ⋮ ident: "foo",
+ ⋮ nested: [
+ ⋮ Literal(5),
+ ⋮ ],
+ ⋮}
+ "###);
+
+ assert_eq!(meta, inner.into());
}
#[test]
fn test_parse_meta_item_multiple() {
- test::<MetaList>("foo(word, name = 5, list(name2 = 6), word2)");
+ let input = "foo(word, name = 5, list(name2 = 6), word2)";
+ let (inner, meta) = (input, input);
+
+ snapshot!(inner as MetaList, @r###"
+ ⋮MetaList {
+ ⋮ ident: "foo",
+ ⋮ nested: [
+ ⋮ Meta(Word("word")),
+ ⋮ Meta(Meta::NameValue {
+ ⋮ ident: "name",
+ ⋮ lit: 5,
+ ⋮ }),
+ ⋮ Meta(Meta::List {
+ ⋮ ident: "list",
+ ⋮ nested: [
+ ⋮ Meta(Meta::NameValue {
+ ⋮ ident: "name2",
+ ⋮ lit: 6,
+ ⋮ }),
+ ⋮ ],
+ ⋮ }),
+ ⋮ Meta(Word("word2")),
+ ⋮ ],
+ ⋮}
+ "###);
+
+ snapshot!(meta as Meta, @r###"
+ ⋮Meta::List {
+ ⋮ ident: "foo",
+ ⋮ nested: [
+ ⋮ Meta(Word("word")),
+ ⋮ Meta(Meta::NameValue {
+ ⋮ ident: "name",
+ ⋮ lit: 5,
+ ⋮ }),
+ ⋮ Meta(Meta::List {
+ ⋮ ident: "list",
+ ⋮ nested: [
+ ⋮ Meta(Meta::NameValue {
+ ⋮ ident: "name2",
+ ⋮ lit: 6,
+ ⋮ }),
+ ⋮ ],
+ ⋮ }),
+ ⋮ Meta(Word("word2")),
+ ⋮ ],
+ ⋮}
+ "###);
+
+ assert_eq!(meta, inner.into());
}
#[test]
fn test_parse_nested_meta() {
- let code = "5";
- snapshot!(code as NestedMeta);
+ let input = "5";
+ snapshot!(input as NestedMeta, @"Literal(5)");
- let code = "list(name2 = 6)";
- snapshot!(code as NestedMeta);
-}
-
-fn test<T>(input: &str)
-where
- T: Parse + Into<Meta> + Debug,
-{
- let inner = snapshot!(input as T);
- let meta = snapshot!(input as Meta);
-
- assert_eq!(meta, inner.into());
+ let input = "list(name2 = 6)";
+ snapshot!(input as NestedMeta, @r###"
+ ⋮Meta(Meta::List {
+ ⋮ ident: "list",
+ ⋮ nested: [
+ ⋮ Meta(Meta::NameValue {
+ ⋮ ident: "name2",
+ ⋮ lit: 6,
+ ⋮ }),
+ ⋮ ],
+ ⋮})
+ "###);
}
diff --git a/tests/test_token_trees.rs b/tests/test_token_trees.rs
index 6e2d2dd..70a9a72 100644
--- a/tests/test_token_trees.rs
+++ b/tests/test_token_trees.rs
@@ -13,7 +13,7 @@
#[test]
fn test_struct() {
- let code = "
+ let input = "
#[derive(Debug, Clone)]
pub struct Item {
pub ident: Ident,
@@ -21,7 +21,7 @@
}
";
- snapshot!(code as TokenStream);
+ snapshot!(input as TokenStream, @"`# [ derive ( Debug , Clone ) ] pub struct Item { pub ident : Ident , pub attrs : Vec < Attribute >, }`");
}
#[test]