diff options
Diffstat (limited to 'vendor/syn/tests/debug')
-rw-r--r-- | vendor/syn/tests/debug/gen.rs | 3843 | ||||
-rw-r--r-- | vendor/syn/tests/debug/mod.rs | 18 |
2 files changed, 1451 insertions, 2410 deletions
diff --git a/vendor/syn/tests/debug/gen.rs b/vendor/syn/tests/debug/gen.rs index cfd63d117..b64cc3e7e 100644 --- a/vendor/syn/tests/debug/gen.rs +++ b/vendor/syn/tests/debug/gen.rs @@ -1,22 +1,21 @@ // This file is @generated by syn-internal-codegen. // It is not intended for manual editing. -use super::{Lite, RefCast}; +#![allow(clippy::match_wildcard_for_single_variants)] +use super::{Lite, Present}; +use ref_cast::RefCast; use std::fmt::{self, Debug, Display}; 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 { + if let Some(val) = &self.value.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("Some(")?; + Debug::fmt(Lite(&self.0), formatter)?; formatter.write_str(")")?; Ok(()) } @@ -28,73 +27,94 @@ impl Debug for Lite<syn::Abi> { } 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 { + if self.value.colon2_token.is_some() { + formatter.field("colon2_token", &Present); + } + if !self.value.args.is_empty() { + formatter.field("args", Lite(&self.value.args)); + } + formatter.finish() + } +} +impl Debug for Lite<syn::Arm> { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("Arm"); + if !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.attrs)); + } + formatter.field("pat", Lite(&self.value.pat)); + if let Some(val) = &self.value.guard { #[derive(RefCast)] #[repr(transparent)] - struct Print(syn::token::Colon2); + 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")?; + formatter.write_str("Some(")?; + Debug::fmt(Lite(&self.0.1), formatter)?; + formatter.write_str(")")?; Ok(()) } } - formatter.field("colon2_token", Print::ref_cast(val)); + formatter.field("guard", Print::ref_cast(val)); } - if !_val.args.is_empty() { - formatter.field("args", Lite(&_val.args)); + formatter.field("body", Lite(&self.value.body)); + if self.value.comma.is_some() { + formatter.field("comma", &Present); } formatter.finish() } } -impl Debug for Lite<syn::Arm> { +impl Debug for Lite<syn::AssocConst> { 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)); - } - formatter.field("pat", Lite(&_val.pat)); - if let Some(val) = &_val.guard { + let mut formatter = formatter.debug_struct("AssocConst"); + formatter.field("ident", Lite(&self.value.ident)); + if let Some(val) = &self.value.generics { #[derive(RefCast)] #[repr(transparent)] - struct Print((syn::token::If, Box<syn::Expr>)); + struct Print(syn::AngleBracketedGenericArguments); 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("Some(")?; + Debug::fmt(Lite(&self.0), formatter)?; formatter.write_str(")")?; Ok(()) } } - formatter.field("guard", Print::ref_cast(val)); + formatter.field("generics", Print::ref_cast(val)); } - formatter.field("body", Lite(&_val.body)); - if let Some(val) = &_val.comma { + formatter.field("value", Lite(&self.value.value)); + formatter.finish() + } +} +impl Debug for Lite<syn::AssocType> { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("AssocType"); + formatter.field("ident", Lite(&self.value.ident)); + if let Some(val) = &self.value.generics { #[derive(RefCast)] #[repr(transparent)] - struct Print(syn::token::Comma); + struct Print(syn::AngleBracketedGenericArguments); impl Debug for Print { fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - formatter.write_str("Some")?; + formatter.write_str("Some(")?; + Debug::fmt(Lite(&self.0), formatter)?; + formatter.write_str(")")?; Ok(()) } } - formatter.field("comma", Print::ref_cast(val)); + formatter.field("generics", Print::ref_cast(val)); } + formatter.field("ty", Lite(&self.value.ty)); 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"), + match &self.value { + syn::AttrStyle::Outer => formatter.write_str("AttrStyle::Outer"), syn::AttrStyle::Inner(_val) => { - formatter.write_str("Inner")?; + formatter.write_str("AttrStyle::Inner")?; Ok(()) } } @@ -102,220 +122,218 @@ impl Debug for Lite<syn::AttrStyle> { } 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("tokens", Lite(&_val.tokens)); + formatter.field("style", Lite(&self.value.style)); + formatter.field("meta", Lite(&self.value.meta)); 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 !_val.attrs.is_empty() { - formatter.field("attrs", Lite(&_val.attrs)); + if !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.attrs)); } - if let Some(val) = &_val.name { + if let Some(val) = &self.value.name { #[derive(RefCast)] #[repr(transparent)] struct Print((proc_macro2::Ident, 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("Some(")?; + Debug::fmt(Lite(&self.0.0), formatter)?; formatter.write_str(")")?; Ok(()) } } formatter.field("name", Print::ref_cast(val)); } - formatter.field("ty", Lite(&_val.ty)); + formatter.field("ty", Lite(&self.value.ty)); + formatter.finish() + } +} +impl Debug for Lite<syn::BareVariadic> { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("BareVariadic"); + if !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.attrs)); + } + if let Some(val) = &self.value.name { + #[derive(RefCast)] + #[repr(transparent)] + struct Print((proc_macro2::Ident, syn::token::Colon)); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some(")?; + Debug::fmt(Lite(&self.0.0), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + } + formatter.field("name", Print::ref_cast(val)); + } + if self.value.comma.is_some() { + formatter.field("comma", &Present); + } formatter.finish() } } impl Debug for Lite<syn::BinOp> { fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - let _val = &self.value; - match _val { + match &self.value { syn::BinOp::Add(_val) => { - formatter.write_str("Add")?; + formatter.write_str("BinOp::Add")?; Ok(()) } syn::BinOp::Sub(_val) => { - formatter.write_str("Sub")?; + formatter.write_str("BinOp::Sub")?; Ok(()) } syn::BinOp::Mul(_val) => { - formatter.write_str("Mul")?; + formatter.write_str("BinOp::Mul")?; Ok(()) } syn::BinOp::Div(_val) => { - formatter.write_str("Div")?; + formatter.write_str("BinOp::Div")?; Ok(()) } syn::BinOp::Rem(_val) => { - formatter.write_str("Rem")?; + formatter.write_str("BinOp::Rem")?; Ok(()) } syn::BinOp::And(_val) => { - formatter.write_str("And")?; + formatter.write_str("BinOp::And")?; Ok(()) } syn::BinOp::Or(_val) => { - formatter.write_str("Or")?; + formatter.write_str("BinOp::Or")?; Ok(()) } syn::BinOp::BitXor(_val) => { - formatter.write_str("BitXor")?; + formatter.write_str("BinOp::BitXor")?; Ok(()) } syn::BinOp::BitAnd(_val) => { - formatter.write_str("BitAnd")?; + formatter.write_str("BinOp::BitAnd")?; Ok(()) } syn::BinOp::BitOr(_val) => { - formatter.write_str("BitOr")?; + formatter.write_str("BinOp::BitOr")?; Ok(()) } syn::BinOp::Shl(_val) => { - formatter.write_str("Shl")?; + formatter.write_str("BinOp::Shl")?; Ok(()) } syn::BinOp::Shr(_val) => { - formatter.write_str("Shr")?; + formatter.write_str("BinOp::Shr")?; Ok(()) } syn::BinOp::Eq(_val) => { - formatter.write_str("Eq")?; + formatter.write_str("BinOp::Eq")?; Ok(()) } syn::BinOp::Lt(_val) => { - formatter.write_str("Lt")?; + formatter.write_str("BinOp::Lt")?; Ok(()) } syn::BinOp::Le(_val) => { - formatter.write_str("Le")?; + formatter.write_str("BinOp::Le")?; Ok(()) } syn::BinOp::Ne(_val) => { - formatter.write_str("Ne")?; + formatter.write_str("BinOp::Ne")?; Ok(()) } syn::BinOp::Ge(_val) => { - formatter.write_str("Ge")?; + formatter.write_str("BinOp::Ge")?; Ok(()) } syn::BinOp::Gt(_val) => { - formatter.write_str("Gt")?; + formatter.write_str("BinOp::Gt")?; Ok(()) } - syn::BinOp::AddEq(_val) => { - formatter.write_str("AddEq")?; + syn::BinOp::AddAssign(_val) => { + formatter.write_str("BinOp::AddAssign")?; Ok(()) } - syn::BinOp::SubEq(_val) => { - formatter.write_str("SubEq")?; + syn::BinOp::SubAssign(_val) => { + formatter.write_str("BinOp::SubAssign")?; Ok(()) } - syn::BinOp::MulEq(_val) => { - formatter.write_str("MulEq")?; + syn::BinOp::MulAssign(_val) => { + formatter.write_str("BinOp::MulAssign")?; Ok(()) } - syn::BinOp::DivEq(_val) => { - formatter.write_str("DivEq")?; + syn::BinOp::DivAssign(_val) => { + formatter.write_str("BinOp::DivAssign")?; Ok(()) } - syn::BinOp::RemEq(_val) => { - formatter.write_str("RemEq")?; + syn::BinOp::RemAssign(_val) => { + formatter.write_str("BinOp::RemAssign")?; Ok(()) } - syn::BinOp::BitXorEq(_val) => { - formatter.write_str("BitXorEq")?; + syn::BinOp::BitXorAssign(_val) => { + formatter.write_str("BinOp::BitXorAssign")?; Ok(()) } - syn::BinOp::BitAndEq(_val) => { - formatter.write_str("BitAndEq")?; + syn::BinOp::BitAndAssign(_val) => { + formatter.write_str("BinOp::BitAndAssign")?; Ok(()) } - syn::BinOp::BitOrEq(_val) => { - formatter.write_str("BitOrEq")?; + syn::BinOp::BitOrAssign(_val) => { + formatter.write_str("BinOp::BitOrAssign")?; Ok(()) } - syn::BinOp::ShlEq(_val) => { - formatter.write_str("ShlEq")?; + syn::BinOp::ShlAssign(_val) => { + formatter.write_str("BinOp::ShlAssign")?; Ok(()) } - syn::BinOp::ShrEq(_val) => { - formatter.write_str("ShrEq")?; + syn::BinOp::ShrAssign(_val) => { + formatter.write_str("BinOp::ShrAssign")?; Ok(()) } + _ => unreachable!(), } } } -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)); + if !self.value.stmts.is_empty() { + formatter.field("stmts", Lite(&self.value.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)); + if !self.value.lifetimes.is_empty() { + formatter.field("lifetimes", Lite(&self.value.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)); + if !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.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)); + formatter.field("ident", Lite(&self.value.ident)); + formatter.field("ty", Lite(&self.value.ty)); + if self.value.eq_token.is_some() { + formatter.field("eq_token", &Present); } - if let Some(val) = &_val.default { + if let Some(val) = &self.value.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("Some(")?; + Debug::fmt(Lite(&self.0), formatter)?; formatter.write_str(")")?; Ok(()) } @@ -327,33 +345,36 @@ impl Debug for Lite<syn::ConstParam> { } 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.field("ident", Lite(&self.value.ident)); + if let Some(val) = &self.value.generics { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::AngleBracketedGenericArguments); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some(")?; + Debug::fmt(Lite(&self.0), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + } + formatter.field("generics", Print::ref_cast(val)); + } + if !self.value.bounds.is_empty() { + formatter.field("bounds", Lite(&self.value.bounds)); } formatter.finish() } } impl Debug for Lite<syn::Data> { fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - let _val = &self.value; - match _val { + match &self.value { 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)); + if _val.semi_token.is_some() { + formatter.field("semi_token", &Present); } formatter.finish() } @@ -374,60 +395,46 @@ impl Debug for Lite<syn::Data> { } 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)); + if !self.value.variants.is_empty() { + formatter.field("variants", Lite(&self.value.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.field("fields", Lite(&self.value.fields)); + if self.value.semi_token.is_some() { + formatter.field("semi_token", &Present); } 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.field("fields", Lite(&self.value.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)); + if !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.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.field("vis", Lite(&self.value.vis)); + formatter.field("ident", Lite(&self.value.ident)); + formatter.field("generics", Lite(&self.value.generics)); + formatter.field("data", Lite(&self.value.data)); formatter.finish() } } impl Debug for Lite<syn::Expr> { fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - let _val = &self.value; - match _val { + match &self.value { syn::Expr::Array(_val) => { let mut formatter = formatter.debug_struct("Expr::Array"); if !_val.attrs.is_empty() { @@ -447,32 +454,13 @@ impl Debug for Lite<syn::Expr> { 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::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)); + if _val.capture.is_some() { + formatter.field("capture", &Present); } formatter.field("block", Lite(&_val.block)); formatter.finish() @@ -506,10 +494,8 @@ impl Debug for Lite<syn::Expr> { 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("Some(")?; + Debug::fmt(Lite(&self.0), formatter)?; formatter.write_str(")")?; Ok(()) } @@ -519,14 +505,6 @@ impl Debug for Lite<syn::Expr> { formatter.field("block", Lite(&_val.block)); formatter.finish() } - 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::Break(_val) => { let mut formatter = formatter.debug_struct("Expr::Break"); if !_val.attrs.is_empty() { @@ -538,10 +516,8 @@ impl Debug for Lite<syn::Expr> { 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("Some(")?; + Debug::fmt(Lite(&self.0), formatter)?; formatter.write_str(")")?; Ok(()) } @@ -554,10 +530,8 @@ impl Debug for Lite<syn::Expr> { 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("Some(")?; + Debug::fmt(Lite(&self.0), formatter)?; formatter.write_str(")")?; Ok(()) } @@ -591,41 +565,31 @@ impl Debug for Lite<syn::Expr> { if !_val.attrs.is_empty() { formatter.field("attrs", Lite(&_val.attrs)); } - if let Some(val) = &_val.movability { + if let Some(val) = &_val.lifetimes { #[derive(RefCast)] #[repr(transparent)] - struct Print(syn::token::Static); + struct Print(syn::BoundLifetimes); impl Debug for Print { fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - formatter.write_str("Some")?; + formatter.write_str("Some(")?; + Debug::fmt(Lite(&self.0), formatter)?; + formatter.write_str(")")?; Ok(()) } } - formatter.field("movability", Print::ref_cast(val)); + formatter.field("lifetimes", 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 _val.constness.is_some() { + formatter.field("constness", &Present); } - 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.movability.is_some() { + formatter.field("movability", &Present); + } + if _val.asyncness.is_some() { + formatter.field("asyncness", &Present); + } + if _val.capture.is_some() { + formatter.field("capture", &Present); } if !_val.inputs.is_empty() { formatter.field("inputs", Lite(&_val.inputs)); @@ -634,6 +598,14 @@ impl Debug for Lite<syn::Expr> { formatter.field("body", Lite(&_val.body)); formatter.finish() } + syn::Expr::Const(_val) => { + let mut formatter = formatter.debug_struct("Expr::Const"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("block", Lite(&_val.block)); + formatter.finish() + } syn::Expr::Continue(_val) => { let mut formatter = formatter.debug_struct("Expr::Continue"); if !_val.attrs.is_empty() { @@ -645,10 +617,8 @@ impl Debug for Lite<syn::Expr> { 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("Some(")?; + Debug::fmt(Lite(&self.0), formatter)?; formatter.write_str(")")?; Ok(()) } @@ -677,10 +647,8 @@ impl Debug for Lite<syn::Expr> { 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("Some(")?; + Debug::fmt(Lite(&self.0), formatter)?; formatter.write_str(")")?; Ok(()) } @@ -713,10 +681,8 @@ impl Debug for Lite<syn::Expr> { 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("Some(")?; + Debug::fmt(Lite(&self.0.1), formatter)?; formatter.write_str(")")?; Ok(()) } @@ -734,6 +700,13 @@ impl Debug for Lite<syn::Expr> { formatter.field("index", Lite(&_val.index)); formatter.finish() } + syn::Expr::Infer(_val) => { + let mut formatter = formatter.debug_struct("Expr::Infer"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.finish() + } syn::Expr::Let(_val) => { let mut formatter = formatter.debug_struct("Expr::Let"); if !_val.attrs.is_empty() { @@ -762,10 +735,8 @@ impl Debug for Lite<syn::Expr> { 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("Some(")?; + Debug::fmt(Lite(&self.0), formatter)?; formatter.write_str(")")?; Ok(()) } @@ -804,13 +775,11 @@ impl Debug for Lite<syn::Expr> { if let Some(val) = &_val.turbofish { #[derive(RefCast)] #[repr(transparent)] - struct Print(syn::MethodTurbofish); + struct Print(syn::AngleBracketedGenericArguments); 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("Some(")?; + Debug::fmt(Lite(&self.0), formatter)?; formatter.write_str(")")?; Ok(()) } @@ -841,10 +810,8 @@ impl Debug for Lite<syn::Expr> { 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("Some(")?; + Debug::fmt(Lite(&self.0), formatter)?; formatter.write_str(")")?; Ok(()) } @@ -859,38 +826,34 @@ impl Debug for Lite<syn::Expr> { if !_val.attrs.is_empty() { formatter.field("attrs", Lite(&_val.attrs)); } - if let Some(val) = &_val.from { + if let Some(val) = &_val.start { #[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("Some(")?; + Debug::fmt(Lite(&self.0), formatter)?; formatter.write_str(")")?; Ok(()) } } - formatter.field("from", Print::ref_cast(val)); + formatter.field("start", Print::ref_cast(val)); } formatter.field("limits", Lite(&_val.limits)); - if let Some(val) = &_val.to { + if let Some(val) = &_val.end { #[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("Some(")?; + Debug::fmt(Lite(&self.0), formatter)?; formatter.write_str(")")?; Ok(()) } } - formatter.field("to", Print::ref_cast(val)); + formatter.field("end", Print::ref_cast(val)); } formatter.finish() } @@ -899,17 +862,8 @@ impl Debug for Lite<syn::Expr> { 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)); + if _val.mutability.is_some() { + formatter.field("mutability", &Present); } formatter.field("expr", Lite(&_val.expr)); formatter.finish() @@ -934,10 +888,8 @@ impl Debug for Lite<syn::Expr> { 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("Some(")?; + Debug::fmt(Lite(&self.0), formatter)?; formatter.write_str(")")?; Ok(()) } @@ -951,21 +903,26 @@ impl Debug for Lite<syn::Expr> { 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 { + if let Some(val) = &_val.qself { #[derive(RefCast)] #[repr(transparent)] - struct Print(syn::token::Dot2); + struct Print(syn::QSelf); impl Debug for Print { fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - formatter.write_str("Some")?; + formatter.write_str("Some(")?; + Debug::fmt(Lite(&self.0), formatter)?; + formatter.write_str(")")?; Ok(()) } } - formatter.field("dot2_token", Print::ref_cast(val)); + formatter.field("qself", Print::ref_cast(val)); + } + formatter.field("path", Lite(&_val.path)); + if !_val.fields.is_empty() { + formatter.field("fields", Lite(&_val.fields)); + } + if _val.dot2_token.is_some() { + formatter.field("dot2_token", &Present); } if let Some(val) = &_val.rest { #[derive(RefCast)] @@ -973,10 +930,8 @@ impl Debug for Lite<syn::Expr> { 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("Some(")?; + Debug::fmt(Lite(&self.0), formatter)?; formatter.write_str(")")?; Ok(()) } @@ -1011,15 +966,6 @@ impl Debug for Lite<syn::Expr> { } 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::Unary(_val) => { let mut formatter = formatter.debug_struct("Expr::Unary"); if !_val.attrs.is_empty() { @@ -1038,7 +984,7 @@ impl Debug for Lite<syn::Expr> { formatter.finish() } syn::Expr::Verbatim(_val) => { - formatter.write_str("Verbatim")?; + formatter.write_str("Expr::Verbatim")?; formatter.write_str("(`")?; Display::fmt(_val, formatter)?; formatter.write_str("`)")?; @@ -1055,10 +1001,8 @@ impl Debug for Lite<syn::Expr> { 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("Some(")?; + Debug::fmt(Lite(&self.0), formatter)?; formatter.write_str(")")?; Ok(()) } @@ -1080,10 +1024,8 @@ impl Debug for Lite<syn::Expr> { 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("Some(")?; + Debug::fmt(Lite(&self.0), formatter)?; formatter.write_str(")")?; Ok(()) } @@ -1098,160 +1040,114 @@ impl Debug for Lite<syn::Expr> { } 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 !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.attrs)); } - if !_val.elems.is_empty() { - formatter.field("elems", Lite(&_val.elems)); + if !self.value.elems.is_empty() { + formatter.field("elems", Lite(&self.value.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)); + if !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.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.field("left", Lite(&self.value.left)); + formatter.field("right", Lite(&self.value.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 !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.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)); + if self.value.capture.is_some() { + formatter.field("capture", &Present); } - formatter.field("block", Lite(&_val.block)); + formatter.field("block", Lite(&self.value.block)); formatter.finish() } } impl Debug for Lite<syn::ExprAwait> { fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - let _val = &self.value; let mut formatter = formatter.debug_struct("ExprAwait"); - if !_val.attrs.is_empty() { - formatter.field("attrs", Lite(&_val.attrs)); + if !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.attrs)); } - formatter.field("base", Lite(&_val.base)); + formatter.field("base", Lite(&self.value.base)); 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)); + if !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.attrs)); } - formatter.field("left", Lite(&_val.left)); - formatter.field("op", Lite(&_val.op)); - formatter.field("right", Lite(&_val.right)); + formatter.field("left", Lite(&self.value.left)); + formatter.field("op", Lite(&self.value.op)); + formatter.field("right", Lite(&self.value.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 !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.attrs)); } - if let Some(val) = &_val.label { + if let Some(val) = &self.value.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("Some(")?; + Debug::fmt(Lite(&self.0), 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.field("block", Lite(&self.value.block)); 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 !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.attrs)); } - if let Some(val) = &_val.label { + if let Some(val) = &self.value.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("Some(")?; + Debug::fmt(Lite(&self.0), formatter)?; formatter.write_str(")")?; Ok(()) } } formatter.field("label", Print::ref_cast(val)); } - if let Some(val) = &_val.expr { + if let Some(val) = &self.value.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("Some(")?; + Debug::fmt(Lite(&self.0), formatter)?; formatter.write_str(")")?; Ok(()) } @@ -1263,98 +1159,92 @@ impl Debug for Lite<syn::ExprBreak> { } 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)); + if !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.attrs)); } - formatter.field("func", Lite(&_val.func)); - if !_val.args.is_empty() { - formatter.field("args", Lite(&_val.args)); + formatter.field("func", Lite(&self.value.func)); + if !self.value.args.is_empty() { + formatter.field("args", Lite(&self.value.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)); + if !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.attrs)); } - formatter.field("expr", Lite(&_val.expr)); - formatter.field("ty", Lite(&_val.ty)); + formatter.field("expr", Lite(&self.value.expr)); + formatter.field("ty", Lite(&self.value.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 !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.attrs)); } - if let Some(val) = &_val.movability { + if let Some(val) = &self.value.lifetimes { #[derive(RefCast)] #[repr(transparent)] - struct Print(syn::token::Static); + struct Print(syn::BoundLifetimes); impl Debug for Print { fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - formatter.write_str("Some")?; + formatter.write_str("Some(")?; + Debug::fmt(Lite(&self.0), formatter)?; + formatter.write_str(")")?; Ok(()) } } - formatter.field("movability", Print::ref_cast(val)); + formatter.field("lifetimes", 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 self.value.constness.is_some() { + formatter.field("constness", &Present); } - 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 self.value.movability.is_some() { + formatter.field("movability", &Present); + } + if self.value.asyncness.is_some() { + formatter.field("asyncness", &Present); + } + if self.value.capture.is_some() { + formatter.field("capture", &Present); } - if !_val.inputs.is_empty() { - formatter.field("inputs", Lite(&_val.inputs)); + if !self.value.inputs.is_empty() { + formatter.field("inputs", Lite(&self.value.inputs)); + } + formatter.field("output", Lite(&self.value.output)); + formatter.field("body", Lite(&self.value.body)); + formatter.finish() + } +} +impl Debug for Lite<syn::ExprConst> { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("ExprConst"); + if !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.attrs)); } - formatter.field("output", Lite(&_val.output)); - formatter.field("body", Lite(&_val.body)); + formatter.field("block", Lite(&self.value.block)); 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 !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.attrs)); } - if let Some(val) = &_val.label { + if let Some(val) = &self.value.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("Some(")?; + Debug::fmt(Lite(&self.0), formatter)?; formatter.write_str(")")?; Ok(()) } @@ -1366,75 +1256,67 @@ impl Debug for Lite<syn::ExprContinue> { } 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)); + if !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.attrs)); } - formatter.field("base", Lite(&_val.base)); - formatter.field("member", Lite(&_val.member)); + formatter.field("base", Lite(&self.value.base)); + formatter.field("member", Lite(&self.value.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 !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.attrs)); } - if let Some(val) = &_val.label { + if let Some(val) = &self.value.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("Some(")?; + Debug::fmt(Lite(&self.0), 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.field("pat", Lite(&self.value.pat)); + formatter.field("expr", Lite(&self.value.expr)); + formatter.field("body", Lite(&self.value.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)); + if !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.attrs)); } - formatter.field("expr", Lite(&_val.expr)); + formatter.field("expr", Lite(&self.value.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)); + if !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.attrs)); } - formatter.field("cond", Lite(&_val.cond)); - formatter.field("then_branch", Lite(&_val.then_branch)); - if let Some(val) = &_val.else_branch { + formatter.field("cond", Lite(&self.value.cond)); + formatter.field("then_branch", Lite(&self.value.then_branch)); + if let Some(val) = &self.value.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("Some(")?; + Debug::fmt(Lite(&self.0.1), formatter)?; formatter.write_str(")")?; Ok(()) } @@ -1446,255 +1328,230 @@ impl Debug for Lite<syn::ExprIf> { } 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)); + if !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.attrs)); + } + formatter.field("expr", Lite(&self.value.expr)); + formatter.field("index", Lite(&self.value.index)); + formatter.finish() + } +} +impl Debug for Lite<syn::ExprInfer> { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("ExprInfer"); + if !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.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 !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.attrs)); } - formatter.field("pat", Lite(&_val.pat)); - formatter.field("expr", Lite(&_val.expr)); + formatter.field("pat", Lite(&self.value.pat)); + formatter.field("expr", Lite(&self.value.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)); + if !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.attrs)); } - formatter.field("lit", Lite(&_val.lit)); + formatter.field("lit", Lite(&self.value.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 !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.attrs)); } - if let Some(val) = &_val.label { + if let Some(val) = &self.value.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("Some(")?; + Debug::fmt(Lite(&self.0), formatter)?; formatter.write_str(")")?; Ok(()) } } formatter.field("label", Print::ref_cast(val)); } - formatter.field("body", Lite(&_val.body)); + formatter.field("body", Lite(&self.value.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)); + if !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.attrs)); } - formatter.field("mac", Lite(&_val.mac)); + formatter.field("mac", Lite(&self.value.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)); + if !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.attrs)); } - formatter.field("expr", Lite(&_val.expr)); - if !_val.arms.is_empty() { - formatter.field("arms", Lite(&_val.arms)); + formatter.field("expr", Lite(&self.value.expr)); + if !self.value.arms.is_empty() { + formatter.field("arms", Lite(&self.value.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)); + if !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.attrs)); } - formatter.field("receiver", Lite(&_val.receiver)); - formatter.field("method", Lite(&_val.method)); - if let Some(val) = &_val.turbofish { + formatter.field("receiver", Lite(&self.value.receiver)); + formatter.field("method", Lite(&self.value.method)); + if let Some(val) = &self.value.turbofish { #[derive(RefCast)] #[repr(transparent)] - struct Print(syn::MethodTurbofish); + struct Print(syn::AngleBracketedGenericArguments); 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("Some(")?; + Debug::fmt(Lite(&self.0), formatter)?; formatter.write_str(")")?; Ok(()) } } formatter.field("turbofish", Print::ref_cast(val)); } - if !_val.args.is_empty() { - formatter.field("args", Lite(&_val.args)); + if !self.value.args.is_empty() { + formatter.field("args", Lite(&self.value.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)); + if !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.attrs)); } - formatter.field("expr", Lite(&_val.expr)); + formatter.field("expr", Lite(&self.value.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 !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.attrs)); } - if let Some(val) = &_val.qself { + if let Some(val) = &self.value.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("Some(")?; + Debug::fmt(Lite(&self.0), formatter)?; formatter.write_str(")")?; Ok(()) } } formatter.field("qself", Print::ref_cast(val)); } - formatter.field("path", Lite(&_val.path)); + formatter.field("path", Lite(&self.value.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 !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.attrs)); } - if let Some(val) = &_val.from { + if let Some(val) = &self.value.start { #[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("Some(")?; + Debug::fmt(Lite(&self.0), formatter)?; formatter.write_str(")")?; Ok(()) } } - formatter.field("from", Print::ref_cast(val)); + formatter.field("start", Print::ref_cast(val)); } - formatter.field("limits", Lite(&_val.limits)); - if let Some(val) = &_val.to { + formatter.field("limits", Lite(&self.value.limits)); + if let Some(val) = &self.value.end { #[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("Some(")?; + Debug::fmt(Lite(&self.0), formatter)?; formatter.write_str(")")?; Ok(()) } } - formatter.field("to", Print::ref_cast(val)); + formatter.field("end", 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 !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.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)); + if self.value.mutability.is_some() { + formatter.field("mutability", &Present); } - formatter.field("expr", Lite(&_val.expr)); + formatter.field("expr", Lite(&self.value.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)); + if !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.attrs)); } - formatter.field("expr", Lite(&_val.expr)); - formatter.field("len", Lite(&_val.len)); + formatter.field("expr", Lite(&self.value.expr)); + formatter.field("len", Lite(&self.value.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 !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.attrs)); } - if let Some(val) = &_val.expr { + if let Some(val) = &self.value.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("Some(")?; + Debug::fmt(Lite(&self.0), formatter)?; formatter.write_str(")")?; Ok(()) } @@ -1706,37 +1563,39 @@ impl Debug for Lite<syn::ExprReturn> { } 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)); + if !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.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 { + if let Some(val) = &self.value.qself { #[derive(RefCast)] #[repr(transparent)] - struct Print(syn::token::Dot2); + struct Print(syn::QSelf); impl Debug for Print { fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - formatter.write_str("Some")?; + formatter.write_str("Some(")?; + Debug::fmt(Lite(&self.0), formatter)?; + formatter.write_str(")")?; Ok(()) } } - formatter.field("dot2_token", Print::ref_cast(val)); + formatter.field("qself", Print::ref_cast(val)); } - if let Some(val) = &_val.rest { + formatter.field("path", Lite(&self.value.path)); + if !self.value.fields.is_empty() { + formatter.field("fields", Lite(&self.value.fields)); + } + if self.value.dot2_token.is_some() { + formatter.field("dot2_token", &Present); + } + if let Some(val) = &self.value.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("Some(")?; + Debug::fmt(Lite(&self.0), formatter)?; formatter.write_str(")")?; Ok(()) } @@ -1748,119 +1607,96 @@ impl Debug for Lite<syn::ExprStruct> { } 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)); + if !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.attrs)); } - formatter.field("expr", Lite(&_val.expr)); + formatter.field("expr", Lite(&self.value.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)); + if !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.attrs)); } - formatter.field("block", Lite(&_val.block)); + formatter.field("block", Lite(&self.value.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 !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.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)); + if !self.value.elems.is_empty() { + formatter.field("elems", Lite(&self.value.elems)); } - 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)); + if !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.attrs)); } - formatter.field("op", Lite(&_val.op)); - formatter.field("expr", Lite(&_val.expr)); + formatter.field("op", Lite(&self.value.op)); + formatter.field("expr", Lite(&self.value.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)); + if !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.attrs)); } - formatter.field("block", Lite(&_val.block)); + formatter.field("block", Lite(&self.value.block)); 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 !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.attrs)); } - if let Some(val) = &_val.label { + if let Some(val) = &self.value.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("Some(")?; + Debug::fmt(Lite(&self.0), 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.field("cond", Lite(&self.value.cond)); + formatter.field("body", Lite(&self.value.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 !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.attrs)); } - if let Some(val) = &_val.expr { + if let Some(val) = &self.value.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("Some(")?; + Debug::fmt(Lite(&self.0), formatter)?; formatter.write_str(")")?; Ok(()) } @@ -1872,96 +1708,77 @@ impl Debug for Lite<syn::ExprYield> { } 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)); + if !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.attrs)); } - formatter.field("vis", Lite(&_val.vis)); - if let Some(val) = &_val.ident { + formatter.field("vis", Lite(&self.value.vis)); + match self.value.mutability { + syn::FieldMutability::None => {} + _ => { + formatter.field("mutability", Lite(&self.value.mutability)); + } + } + if let Some(val) = &self.value.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("Some(")?; + Debug::fmt(Lite(&self.0), 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)); + if self.value.colon_token.is_some() { + formatter.field("colon_token", &Present); } - formatter.field("ty", Lite(&_val.ty)); + formatter.field("ty", Lite(&self.value.ty)); formatter.finish() } } +impl Debug for Lite<syn::FieldMutability> { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + match &self.value { + syn::FieldMutability::None => formatter.write_str("FieldMutability::None"), + _ => unreachable!(), + } + } +} 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)); + if !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.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("member", Lite(&self.value.member)); + if self.value.colon_token.is_some() { + formatter.field("colon_token", &Present); } - formatter.field("pat", Lite(&_val.pat)); + formatter.field("pat", Lite(&self.value.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)); + if !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.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("member", Lite(&self.value.member)); + if self.value.colon_token.is_some() { + formatter.field("colon_token", &Present); } - formatter.field("expr", Lite(&_val.expr)); + formatter.field("expr", Lite(&self.value.expr)); formatter.finish() } } impl Debug for Lite<syn::Fields> { fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - let _val = &self.value; - match _val { + match &self.value { syn::Fields::Named(_val) => { let mut formatter = formatter.debug_struct("Fields::Named"); if !_val.named.is_empty() { @@ -1976,72 +1793,66 @@ impl Debug for Lite<syn::Fields> { } formatter.finish() } - syn::Fields::Unit => formatter.write_str("Unit"), + syn::Fields::Unit => formatter.write_str("Fields::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)); + if !self.value.named.is_empty() { + formatter.field("named", Lite(&self.value.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)); + if !self.value.unnamed.is_empty() { + formatter.field("unnamed", Lite(&self.value.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 { + if let Some(val) = &self.value.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("Some(")?; + Debug::fmt(Lite(&self.0), formatter)?; formatter.write_str(")")?; Ok(()) } } formatter.field("shebang", Print::ref_cast(val)); } - if !_val.attrs.is_empty() { - formatter.field("attrs", Lite(&_val.attrs)); + if !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.attrs)); } - if !_val.items.is_empty() { - formatter.field("items", Lite(&_val.items)); + if !self.value.items.is_empty() { + formatter.field("items", Lite(&self.value.items)); } formatter.finish() } } impl Debug for Lite<syn::FnArg> { fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - let _val = &self.value; - match _val { + match &self.value { syn::FnArg::Receiver(_val) => { - formatter.write_str("Receiver")?; + formatter.write_str("FnArg::Receiver")?; formatter.write_str("(")?; Debug::fmt(Lite(_val), formatter)?; formatter.write_str(")")?; Ok(()) } syn::FnArg::Typed(_val) => { - formatter.write_str("Typed")?; + formatter.write_str("FnArg::Typed")?; formatter.write_str("(")?; Debug::fmt(Lite(_val), formatter)?; formatter.write_str(")")?; @@ -2052,8 +1863,7 @@ impl Debug for Lite<syn::FnArg> { } impl Debug for Lite<syn::ForeignItem> { fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - let _val = &self.value; - match _val { + match &self.value { syn::ForeignItem::Fn(_val) => { let mut formatter = formatter.debug_struct("ForeignItem::Fn"); if !_val.attrs.is_empty() { @@ -2069,17 +1879,11 @@ impl Debug for Lite<syn::ForeignItem> { 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(()) - } + match _val.mutability { + syn::StaticMutability::None => {} + _ => { + formatter.field("mutability", Lite(&_val.mutability)); } - formatter.field("mutability", Print::ref_cast(val)); } formatter.field("ident", Lite(&_val.ident)); formatter.field("ty", Lite(&_val.ty)); @@ -2092,6 +1896,7 @@ impl Debug for Lite<syn::ForeignItem> { } formatter.field("vis", Lite(&_val.vis)); formatter.field("ident", Lite(&_val.ident)); + formatter.field("generics", Lite(&_val.generics)); formatter.finish() } syn::ForeignItem::Macro(_val) => { @@ -2100,22 +1905,13 @@ impl Debug for Lite<syn::ForeignItem> { 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)); + if _val.semi_token.is_some() { + formatter.field("semi_token", &Present); } formatter.finish() } syn::ForeignItem::Verbatim(_val) => { - formatter.write_str("Verbatim")?; + formatter.write_str("ForeignItem::Verbatim")?; formatter.write_str("(`")?; Display::fmt(_val, formatter)?; formatter.write_str("`)")?; @@ -2127,159 +1923,126 @@ impl Debug for Lite<syn::ForeignItem> { } 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)); + if !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.attrs)); } - formatter.field("vis", Lite(&_val.vis)); - formatter.field("sig", Lite(&_val.sig)); + formatter.field("vis", Lite(&self.value.vis)); + formatter.field("sig", Lite(&self.value.sig)); 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)); + if !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.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.field("mac", Lite(&self.value.mac)); + if self.value.semi_token.is_some() { + formatter.field("semi_token", &Present); } 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)); + if !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.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("vis", Lite(&self.value.vis)); + match self.value.mutability { + syn::StaticMutability::None => {} + _ => { + formatter.field("mutability", Lite(&self.value.mutability)); } - formatter.field("mutability", Print::ref_cast(val)); } - formatter.field("ident", Lite(&_val.ident)); - formatter.field("ty", Lite(&_val.ty)); + formatter.field("ident", Lite(&self.value.ident)); + formatter.field("ty", Lite(&self.value.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)); + if !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.attrs)); } - formatter.field("vis", Lite(&_val.vis)); - formatter.field("ident", Lite(&_val.ident)); + formatter.field("vis", Lite(&self.value.vis)); + formatter.field("ident", Lite(&self.value.ident)); + formatter.field("generics", Lite(&self.value.generics)); formatter.finish() } } impl Debug for Lite<syn::GenericArgument> { fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - let _val = &self.value; - match _val { + match &self.value { syn::GenericArgument::Lifetime(_val) => { - formatter.write_str("Lifetime")?; + formatter.write_str("GenericArgument::Lifetime")?; formatter.write_str("(")?; Debug::fmt(Lite(_val), formatter)?; formatter.write_str(")")?; Ok(()) } syn::GenericArgument::Type(_val) => { - formatter.write_str("Type")?; + formatter.write_str("GenericArgument::Type")?; formatter.write_str("(")?; Debug::fmt(Lite(_val), formatter)?; formatter.write_str(")")?; Ok(()) } syn::GenericArgument::Const(_val) => { - formatter.write_str("Const")?; + formatter.write_str("GenericArgument::Const")?; formatter.write_str("(")?; Debug::fmt(Lite(_val), formatter)?; formatter.write_str(")")?; Ok(()) } - syn::GenericArgument::Binding(_val) => { - formatter.write_str("Binding")?; + syn::GenericArgument::AssocType(_val) => { + formatter.write_str("GenericArgument::AssocType")?; formatter.write_str("(")?; Debug::fmt(Lite(_val), formatter)?; formatter.write_str(")")?; Ok(()) } - syn::GenericArgument::Constraint(_val) => { - formatter.write_str("Constraint")?; + syn::GenericArgument::AssocConst(_val) => { + formatter.write_str("GenericArgument::AssocConst")?; 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")?; + syn::GenericArgument::Constraint(_val) => { + formatter.write_str("GenericArgument::Constraint")?; formatter.write_str("(")?; Debug::fmt(Lite(_val), formatter)?; formatter.write_str(")")?; Ok(()) } + _ => unreachable!(), } } } 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")?; + match &self.value { + syn::GenericParam::Lifetime(_val) => { + formatter.write_str("GenericParam::Lifetime")?; formatter.write_str("(")?; Debug::fmt(Lite(_val), formatter)?; formatter.write_str(")")?; Ok(()) } - syn::GenericParam::Lifetime(_val) => { - formatter.write_str("Lifetime")?; + syn::GenericParam::Type(_val) => { + formatter.write_str("GenericParam::Type")?; formatter.write_str("(")?; Debug::fmt(Lite(_val), formatter)?; formatter.write_str(")")?; Ok(()) } syn::GenericParam::Const(_val) => { - formatter.write_str("Const")?; + formatter.write_str("GenericParam::Const")?; formatter.write_str("(")?; Debug::fmt(Lite(_val), formatter)?; formatter.write_str(")")?; @@ -2290,45 +2053,24 @@ impl Debug for Lite<syn::GenericParam> { } 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 self.value.lt_token.is_some() { + formatter.field("lt_token", &Present); } - if !_val.params.is_empty() { - formatter.field("params", Lite(&_val.params)); + if !self.value.params.is_empty() { + formatter.field("params", Lite(&self.value.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 self.value.gt_token.is_some() { + formatter.field("gt_token", &Present); } - if let Some(val) = &_val.where_clause { + if let Some(val) = &self.value.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("Some(")?; + Debug::fmt(Lite(&self.0), formatter)?; formatter.write_str(")")?; Ok(()) } @@ -2340,48 +2082,30 @@ impl Debug for Lite<syn::Generics> { } impl Debug for Lite<syn::ImplItem> { fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - let _val = &self.value; - match _val { + match &self.value { 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)); + if _val.defaultness.is_some() { + formatter.field("defaultness", &Present); } formatter.field("ident", Lite(&_val.ident)); + formatter.field("generics", Lite(&_val.generics)); 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"); + syn::ImplItem::Fn(_val) => { + let mut formatter = formatter.debug_struct("ImplItem::Fn"); 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)); + if _val.defaultness.is_some() { + formatter.field("defaultness", &Present); } formatter.field("sig", Lite(&_val.sig)); formatter.field("block", Lite(&_val.block)); @@ -2393,17 +2117,8 @@ impl Debug for Lite<syn::ImplItem> { 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)); + if _val.defaultness.is_some() { + formatter.field("defaultness", &Present); } formatter.field("ident", Lite(&_val.ident)); formatter.field("generics", Lite(&_val.generics)); @@ -2416,22 +2131,13 @@ impl Debug for Lite<syn::ImplItem> { 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)); + if _val.semi_token.is_some() { + formatter.field("semi_token", &Present); } formatter.finish() } syn::ImplItem::Verbatim(_val) => { - formatter.write_str("Verbatim")?; + formatter.write_str("ImplItem::Verbatim")?; formatter.write_str("(`")?; Display::fmt(_val, formatter)?; formatter.write_str("`)")?; @@ -2443,116 +2149,80 @@ impl Debug for Lite<syn::ImplItem> { } 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)); + if !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.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("vis", Lite(&self.value.vis)); + if self.value.defaultness.is_some() { + formatter.field("defaultness", &Present); } - formatter.field("ident", Lite(&_val.ident)); - formatter.field("ty", Lite(&_val.ty)); - formatter.field("expr", Lite(&_val.expr)); + formatter.field("ident", Lite(&self.value.ident)); + formatter.field("generics", Lite(&self.value.generics)); + formatter.field("ty", Lite(&self.value.ty)); + formatter.field("expr", Lite(&self.value.expr)); formatter.finish() } } -impl Debug for Lite<syn::ImplItemMacro> { +impl Debug for Lite<syn::ImplItemFn> { 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)); + let mut formatter = formatter.debug_struct("ImplItemFn"); + if !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.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.field("vis", Lite(&self.value.vis)); + if self.value.defaultness.is_some() { + formatter.field("defaultness", &Present); } + formatter.field("sig", Lite(&self.value.sig)); + formatter.field("block", Lite(&self.value.block)); formatter.finish() } } -impl Debug for Lite<syn::ImplItemMethod> { +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("ImplItemMethod"); - if !_val.attrs.is_empty() { - formatter.field("attrs", Lite(&_val.attrs)); + let mut formatter = formatter.debug_struct("ImplItemMacro"); + if !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.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("mac", Lite(&self.value.mac)); + if self.value.semi_token.is_some() { + formatter.field("semi_token", &Present); } - 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)); + if !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.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("vis", Lite(&self.value.vis)); + if self.value.defaultness.is_some() { + formatter.field("defaultness", &Present); } - formatter.field("ident", Lite(&_val.ident)); - formatter.field("generics", Lite(&_val.generics)); - formatter.field("ty", Lite(&_val.ty)); + formatter.field("ident", Lite(&self.value.ident)); + formatter.field("generics", Lite(&self.value.generics)); + formatter.field("ty", Lite(&self.value.ty)); formatter.finish() } } +impl Debug for Lite<syn::ImplRestriction> { + fn fmt(&self, _formatter: &mut fmt::Formatter) -> fmt::Result { + unreachable!() + } +} 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.field("index", Lite(&self.value.index)); formatter.finish() } } impl Debug for Lite<syn::Item> { fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - let _val = &self.value; - match _val { + match &self.value { syn::Item::Const(_val) => { let mut formatter = formatter.debug_struct("Item::Const"); if !_val.attrs.is_empty() { @@ -2560,6 +2230,7 @@ impl Debug for Lite<syn::Item> { } 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.field("expr", Lite(&_val.expr)); formatter.finish() @@ -2590,10 +2261,8 @@ impl Debug for Lite<syn::Item> { 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("Some(")?; + Debug::fmt(Lite(&self.0.1), formatter)?; formatter.write_str(")")?; Ok(()) } @@ -2617,6 +2286,9 @@ impl Debug for Lite<syn::Item> { if !_val.attrs.is_empty() { formatter.field("attrs", Lite(&_val.attrs)); } + if _val.unsafety.is_some() { + formatter.field("unsafety", &Present); + } formatter.field("abi", Lite(&_val.abi)); if !_val.items.is_empty() { formatter.field("items", Lite(&_val.items)); @@ -2628,63 +2300,26 @@ impl Debug for Lite<syn::Item> { 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 _val.defaultness.is_some() { + formatter.field("defaultness", &Present); } - 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 _val.unsafety.is_some() { + formatter.field("unsafety", &Present); } 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)); + struct Print((Option<syn::token::Not>, 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("(")?; + formatter.write_str("Some(")?; 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) + &super::Option { + present: self.0.0.is_some(), }, - Lite(&_val.1), + Lite(&self.0.1), ), formatter, )?; @@ -2711,10 +2346,8 @@ impl Debug for Lite<syn::Item> { 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("Some(")?; + Debug::fmt(Lite(&self.0), formatter)?; formatter.write_str(")")?; Ok(()) } @@ -2722,28 +2355,9 @@ impl Debug for Lite<syn::Item> { 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)); + if _val.semi_token.is_some() { + formatter.field("semi_token", &Present); } - formatter.field("vis", Lite(&_val.vis)); - formatter.field("ident", Lite(&_val.ident)); - formatter.field("rules", Lite(&_val.rules)); formatter.finish() } syn::Item::Mod(_val) => { @@ -2752,6 +2366,9 @@ impl Debug for Lite<syn::Item> { formatter.field("attrs", Lite(&_val.attrs)); } formatter.field("vis", Lite(&_val.vis)); + if _val.unsafety.is_some() { + formatter.field("unsafety", &Present); + } formatter.field("ident", Lite(&_val.ident)); if let Some(val) = &_val.content { #[derive(RefCast)] @@ -2759,27 +2376,16 @@ impl Debug for Lite<syn::Item> { 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("Some(")?; + Debug::fmt(Lite(&self.0.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)); + if _val.semi.is_some() { + formatter.field("semi", &Present); } formatter.finish() } @@ -2789,17 +2395,11 @@ impl Debug for Lite<syn::Item> { 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(()) - } + match _val.mutability { + syn::StaticMutability::None => {} + _ => { + formatter.field("mutability", Lite(&_val.mutability)); } - formatter.field("mutability", Print::ref_cast(val)); } formatter.field("ident", Lite(&_val.ident)); formatter.field("ty", Lite(&_val.ty)); @@ -2815,17 +2415,8 @@ impl Debug for Lite<syn::Item> { 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)); + if _val.semi_token.is_some() { + formatter.field("semi_token", &Present); } formatter.finish() } @@ -2835,43 +2426,30 @@ impl Debug for Lite<syn::Item> { 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 _val.unsafety.is_some() { + formatter.field("unsafety", &Present); + } + if _val.auto_token.is_some() { + formatter.field("auto_token", &Present); } - if let Some(val) = &_val.auto_token { + if let Some(val) = &_val.restriction { #[derive(RefCast)] #[repr(transparent)] - struct Print(syn::token::Auto); + struct Print(syn::ImplRestriction); impl Debug for Print { fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - formatter.write_str("Some")?; + formatter.write_str("Some(")?; + Debug::fmt(Lite(&self.0), formatter)?; + formatter.write_str(")")?; Ok(()) } } - formatter.field("auto_token", Print::ref_cast(val)); + formatter.field("restriction", 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.colon_token.is_some() { + formatter.field("colon_token", &Present); } if !_val.supertraits.is_empty() { formatter.field("supertraits", Lite(&_val.supertraits)); @@ -2922,23 +2500,14 @@ impl Debug for Lite<syn::Item> { 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)); + if _val.leading_colon.is_some() { + formatter.field("leading_colon", &Present); } formatter.field("tree", Lite(&_val.tree)); formatter.finish() } syn::Item::Verbatim(_val) => { - formatter.write_str("Verbatim")?; + formatter.write_str("Item::Verbatim")?; formatter.write_str("(`")?; Display::fmt(_val, formatter)?; formatter.write_str("`)")?; @@ -2950,53 +2519,49 @@ impl Debug for Lite<syn::Item> { } 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)); + if !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.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.field("vis", Lite(&self.value.vis)); + formatter.field("ident", Lite(&self.value.ident)); + formatter.field("generics", Lite(&self.value.generics)); + formatter.field("ty", Lite(&self.value.ty)); + formatter.field("expr", Lite(&self.value.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)); + if !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.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.field("vis", Lite(&self.value.vis)); + formatter.field("ident", Lite(&self.value.ident)); + formatter.field("generics", Lite(&self.value.generics)); + if !self.value.variants.is_empty() { + formatter.field("variants", Lite(&self.value.variants)); } 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)); + if !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.attrs)); } - formatter.field("vis", Lite(&_val.vis)); - formatter.field("ident", Lite(&_val.ident)); - if let Some(val) = &_val.rename { + formatter.field("vis", Lite(&self.value.vis)); + formatter.field("ident", Lite(&self.value.ident)); + if let Some(val) = &self.value.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("Some(")?; + Debug::fmt(Lite(&self.0.1), formatter)?; formatter.write_str(")")?; Ok(()) } @@ -3008,95 +2573,58 @@ impl Debug for Lite<syn::ItemExternCrate> { } 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)); + if !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.attrs)); } - formatter.field("vis", Lite(&_val.vis)); - formatter.field("sig", Lite(&_val.sig)); - formatter.field("block", Lite(&_val.block)); + formatter.field("vis", Lite(&self.value.vis)); + formatter.field("sig", Lite(&self.value.sig)); + formatter.field("block", Lite(&self.value.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)); + if !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.attrs)); } - formatter.field("abi", Lite(&_val.abi)); - if !_val.items.is_empty() { - formatter.field("items", Lite(&_val.items)); + if self.value.unsafety.is_some() { + formatter.field("unsafety", &Present); + } + formatter.field("abi", Lite(&self.value.abi)); + if !self.value.items.is_empty() { + formatter.field("items", Lite(&self.value.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 !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.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 self.value.defaultness.is_some() { + formatter.field("defaultness", &Present); } - 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 self.value.unsafety.is_some() { + formatter.field("unsafety", &Present); } - formatter.field("generics", Lite(&_val.generics)); - if let Some(val) = &_val.trait_ { + formatter.field("generics", Lite(&self.value.generics)); + if let Some(val) = &self.value.trait_ { #[derive(RefCast)] #[repr(transparent)] - struct Print((Option<syn::token::Bang>, syn::Path, syn::token::For)); + struct Print((Option<syn::token::Not>, 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("(")?; + formatter.write_str("Some(")?; 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) + &super::Option { + present: self.0.0.is_some(), }, - Lite(&_val.1), + Lite(&self.0.1), ), formatter, )?; @@ -3106,326 +2634,235 @@ impl Debug for Lite<syn::ItemImpl> { } 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.field("self_ty", Lite(&self.value.self_ty)); + if !self.value.items.is_empty() { + formatter.field("items", Lite(&self.value.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 !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.attrs)); } - if let Some(val) = &_val.ident { + if let Some(val) = &self.value.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("Some(")?; + Debug::fmt(Lite(&self.0), 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.field("mac", Lite(&self.value.mac)); + if self.value.semi_token.is_some() { + formatter.field("semi_token", &Present); } 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("rules", Lite(&_val.rules)); - 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)); + if !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.attrs)); + } + formatter.field("vis", Lite(&self.value.vis)); + if self.value.unsafety.is_some() { + formatter.field("unsafety", &Present); } - formatter.field("vis", Lite(&_val.vis)); - formatter.field("ident", Lite(&_val.ident)); - if let Some(val) = &_val.content { + formatter.field("ident", Lite(&self.value.ident)); + if let Some(val) = &self.value.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("Some(")?; + Debug::fmt(Lite(&self.0.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)); + if self.value.semi.is_some() { + formatter.field("semi", &Present); } 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)); + if !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.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("vis", Lite(&self.value.vis)); + match self.value.mutability { + syn::StaticMutability::None => {} + _ => { + formatter.field("mutability", Lite(&self.value.mutability)); } - 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.field("ident", Lite(&self.value.ident)); + formatter.field("ty", Lite(&self.value.ty)); + formatter.field("expr", Lite(&self.value.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)); + if !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.attrs)); + } + formatter.field("vis", Lite(&self.value.vis)); + formatter.field("ident", Lite(&self.value.ident)); + formatter.field("generics", Lite(&self.value.generics)); + formatter.field("fields", Lite(&self.value.fields)); + if self.value.semi_token.is_some() { + formatter.field("semi_token", &Present); } 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)); + if !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.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)); + formatter.field("vis", Lite(&self.value.vis)); + if self.value.unsafety.is_some() { + formatter.field("unsafety", &Present); } - 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)); + if self.value.auto_token.is_some() { + formatter.field("auto_token", &Present); } - formatter.field("ident", Lite(&_val.ident)); - formatter.field("generics", Lite(&_val.generics)); - if let Some(val) = &_val.colon_token { + if let Some(val) = &self.value.restriction { #[derive(RefCast)] #[repr(transparent)] - struct Print(syn::token::Colon); + struct Print(syn::ImplRestriction); impl Debug for Print { fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - formatter.write_str("Some")?; + formatter.write_str("Some(")?; + Debug::fmt(Lite(&self.0), formatter)?; + formatter.write_str(")")?; Ok(()) } } - formatter.field("colon_token", Print::ref_cast(val)); + formatter.field("restriction", Print::ref_cast(val)); + } + formatter.field("ident", Lite(&self.value.ident)); + formatter.field("generics", Lite(&self.value.generics)); + if self.value.colon_token.is_some() { + formatter.field("colon_token", &Present); } - if !_val.supertraits.is_empty() { - formatter.field("supertraits", Lite(&_val.supertraits)); + if !self.value.supertraits.is_empty() { + formatter.field("supertraits", Lite(&self.value.supertraits)); } - if !_val.items.is_empty() { - formatter.field("items", Lite(&_val.items)); + if !self.value.items.is_empty() { + formatter.field("items", Lite(&self.value.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)); + if !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.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.field("vis", Lite(&self.value.vis)); + formatter.field("ident", Lite(&self.value.ident)); + formatter.field("generics", Lite(&self.value.generics)); + if !self.value.bounds.is_empty() { + formatter.field("bounds", Lite(&self.value.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)); + if !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.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.field("vis", Lite(&self.value.vis)); + formatter.field("ident", Lite(&self.value.ident)); + formatter.field("generics", Lite(&self.value.generics)); + formatter.field("ty", Lite(&self.value.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)); + if !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.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.field("vis", Lite(&self.value.vis)); + formatter.field("ident", Lite(&self.value.ident)); + formatter.field("generics", Lite(&self.value.generics)); + formatter.field("fields", Lite(&self.value.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)); + if !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.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("vis", Lite(&self.value.vis)); + if self.value.leading_colon.is_some() { + formatter.field("leading_colon", &Present); } - formatter.field("tree", Lite(&_val.tree)); + formatter.field("tree", Lite(&self.value.tree)); 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.field("name", Lite(&self.value.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.field("ident", Lite(&self.value.ident)); formatter.finish() } } -impl Debug for Lite<syn::LifetimeDef> { +impl Debug for Lite<syn::LifetimeParam> { 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)); + let mut formatter = formatter.debug_struct("LifetimeParam"); + if !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.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)); + formatter.field("lifetime", Lite(&self.value.lifetime)); + if self.value.colon_token.is_some() { + formatter.field("colon_token", &Present); } - if !_val.bounds.is_empty() { - formatter.field("bounds", Lite(&_val.bounds)); + if !self.value.bounds.is_empty() { + formatter.field("bounds", Lite(&self.value.bounds)); } formatter.finish() } } impl Debug for Lite<syn::Lit> { fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - let _val = &self.value; - match _val { + match &self.value { syn::Lit::Str(_val) => write!(formatter, "{:?}", _val.value()), syn::Lit::ByteStr(_val) => write!(formatter, "{:?}", _val.value()), syn::Lit::Byte(_val) => write!(formatter, "{:?}", _val.value()), @@ -3438,77 +2875,68 @@ impl Debug for Lite<syn::Lit> { formatter.finish() } syn::Lit::Verbatim(_val) => { - formatter.write_str("Verbatim")?; + formatter.write_str("Lit::Verbatim")?; formatter.write_str("(`")?; Display::fmt(_val, formatter)?; formatter.write_str("`)")?; Ok(()) } + _ => unreachable!(), } } } 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.field("value", Lite(&self.value.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()) + write!(formatter, "{:?}", self.value.value()) } } impl Debug for Lite<syn::LitByteStr> { fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - let _val = &self.value; - write!(formatter, "{:?}", _val.value()) + write!(formatter, "{:?}", self.value.value()) } } impl Debug for Lite<syn::LitChar> { fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - let _val = &self.value; - write!(formatter, "{:?}", _val.value()) + write!(formatter, "{:?}", self.value.value()) } } impl Debug for Lite<syn::LitFloat> { fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - let _val = &self.value; - write!(formatter, "{}", _val) + write!(formatter, "{}", & self.value) } } impl Debug for Lite<syn::LitInt> { fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - let _val = &self.value; - write!(formatter, "{}", _val) + write!(formatter, "{}", & self.value) } } impl Debug for Lite<syn::LitStr> { fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - let _val = &self.value; - write!(formatter, "{:?}", _val.value()) + write!(formatter, "{:?}", self.value.value()) } } 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 !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.attrs)); } - formatter.field("pat", Lite(&_val.pat)); - if let Some(val) = &_val.init { + formatter.field("pat", Lite(&self.value.pat)); + if let Some(val) = &self.value.init { #[derive(RefCast)] #[repr(transparent)] - struct Print((syn::token::Eq, Box<syn::Expr>)); + struct Print(syn::LocalInit); 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("Some(")?; + Debug::fmt(Lite(&self.0), formatter)?; formatter.write_str(")")?; Ok(()) } @@ -3518,30 +2946,49 @@ impl Debug for Lite<syn::Local> { formatter.finish() } } +impl Debug for Lite<syn::LocalInit> { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("LocalInit"); + formatter.field("expr", Lite(&self.value.expr)); + if let Some(val) = &self.value.diverge { + #[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(")?; + Debug::fmt(Lite(&self.0.1), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + } + formatter.field("diverge", 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("tokens", Lite(&_val.tokens)); + formatter.field("path", Lite(&self.value.path)); + formatter.field("delimiter", Lite(&self.value.delimiter)); + formatter.field("tokens", Lite(&self.value.tokens)); formatter.finish() } } impl Debug for Lite<syn::MacroDelimiter> { fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - let _val = &self.value; - match _val { + match &self.value { syn::MacroDelimiter::Paren(_val) => { - formatter.write_str("Paren")?; + formatter.write_str("MacroDelimiter::Paren")?; Ok(()) } syn::MacroDelimiter::Brace(_val) => { - formatter.write_str("Brace")?; + formatter.write_str("MacroDelimiter::Brace")?; Ok(()) } syn::MacroDelimiter::Bracket(_val) => { - formatter.write_str("Bracket")?; + formatter.write_str("MacroDelimiter::Bracket")?; Ok(()) } } @@ -3549,17 +2996,16 @@ impl Debug for Lite<syn::MacroDelimiter> { } impl Debug for Lite<syn::Member> { fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - let _val = &self.value; - match _val { + match &self.value { syn::Member::Named(_val) => { - formatter.write_str("Named")?; + formatter.write_str("Member::Named")?; formatter.write_str("(")?; Debug::fmt(Lite(_val), formatter)?; formatter.write_str(")")?; Ok(()) } syn::Member::Unnamed(_val) => { - formatter.write_str("Unnamed")?; + formatter.write_str("Member::Unnamed")?; formatter.write_str("(")?; Debug::fmt(Lite(_val), formatter)?; formatter.write_str(")")?; @@ -3570,27 +3016,28 @@ impl Debug for Lite<syn::Member> { } impl Debug for Lite<syn::Meta> { fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - let _val = &self.value; - match _val { + match &self.value { syn::Meta::Path(_val) => { - formatter.write_str("Path")?; - formatter.write_str("(")?; - Debug::fmt(Lite(_val), formatter)?; - formatter.write_str(")")?; - Ok(()) + let mut formatter = formatter.debug_struct("Meta::Path"); + if _val.leading_colon.is_some() { + formatter.field("leading_colon", &Present); + } + if !_val.segments.is_empty() { + formatter.field("segments", Lite(&_val.segments)); + } + formatter.finish() } syn::Meta::List(_val) => { let mut formatter = formatter.debug_struct("Meta::List"); formatter.field("path", Lite(&_val.path)); - if !_val.nested.is_empty() { - formatter.field("nested", Lite(&_val.nested)); - } + formatter.field("delimiter", Lite(&_val.delimiter)); + formatter.field("tokens", Lite(&_val.tokens)); formatter.finish() } syn::Meta::NameValue(_val) => { let mut formatter = formatter.debug_struct("Meta::NameValue"); formatter.field("path", Lite(&_val.path)); - formatter.field("lit", Lite(&_val.lit)); + formatter.field("value", Lite(&_val.value)); formatter.finish() } } @@ -3598,106 +3045,51 @@ impl Debug for Lite<syn::Meta> { } 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("path", Lite(&_val.path)); - if !_val.nested.is_empty() { - formatter.field("nested", Lite(&_val.nested)); - } + formatter.field("path", Lite(&self.value.path)); + formatter.field("delimiter", Lite(&self.value.delimiter)); + formatter.field("tokens", Lite(&self.value.tokens)); 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("path", Lite(&_val.path)); - formatter.field("lit", Lite(&_val.lit)); + formatter.field("path", Lite(&self.value.path)); + formatter.field("value", Lite(&self.value.value)); formatter.finish() } } -impl Debug for Lite<syn::MethodTurbofish> { +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("MethodTurbofish"); - if !_val.args.is_empty() { - formatter.field("args", Lite(&_val.args)); + let mut formatter = formatter.debug_struct("ParenthesizedGenericArguments"); + if !self.value.inputs.is_empty() { + formatter.field("inputs", Lite(&self.value.inputs)); } + formatter.field("output", Lite(&self.value.output)); formatter.finish() } } -impl Debug for Lite<syn::NestedMeta> { +impl Debug for Lite<syn::Pat> { fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - let _val = &self.value; - match _val { - syn::NestedMeta::Meta(_val) => { - formatter.write_str("Meta")?; + match &self.value { + syn::Pat::Const(_val) => { + formatter.write_str("Pat::Const")?; formatter.write_str("(")?; Debug::fmt(Lite(_val), formatter)?; formatter.write_str(")")?; Ok(()) } - syn::NestedMeta::Lit(_val) => { - formatter.write_str("Lit")?; - 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::Box(_val) => { - let mut formatter = formatter.debug_struct("Pat::Box"); - if !_val.attrs.is_empty() { - formatter.field("attrs", Lite(&_val.attrs)); - } - formatter.field("pat", Lite(&_val.pat)); - formatter.finish() - } syn::Pat::Ident(_val) => { let mut formatter = formatter.debug_struct("Pat::Ident"); if !_val.attrs.is_empty() { formatter.field("attrs", Lite(&_val.attrs)); } - 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 _val.by_ref.is_some() { + formatter.field("by_ref", &Present); } - 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)); + if _val.mutability.is_some() { + formatter.field("mutability", &Present); } formatter.field("ident", Lite(&_val.ident)); if let Some(val) = &_val.subpat { @@ -3706,10 +3098,8 @@ impl Debug for Lite<syn::Pat> { 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("Some(")?; + Debug::fmt(Lite(&self.0.1), formatter)?; formatter.write_str(")")?; Ok(()) } @@ -3719,93 +3109,61 @@ impl Debug for Lite<syn::Pat> { formatter.finish() } syn::Pat::Lit(_val) => { - let mut formatter = formatter.debug_struct("Pat::Lit"); - if !_val.attrs.is_empty() { - formatter.field("attrs", Lite(&_val.attrs)); - } - formatter.field("expr", Lite(&_val.expr)); - formatter.finish() + formatter.write_str("Pat::Lit")?; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) } syn::Pat::Macro(_val) => { - let mut formatter = formatter.debug_struct("Pat::Macro"); - if !_val.attrs.is_empty() { - formatter.field("attrs", Lite(&_val.attrs)); - } - formatter.field("mac", Lite(&_val.mac)); - formatter.finish() + formatter.write_str("Pat::Macro")?; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) } syn::Pat::Or(_val) => { let mut formatter = formatter.debug_struct("Pat::Or"); 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.leading_vert.is_some() { + formatter.field("leading_vert", &Present); } if !_val.cases.is_empty() { formatter.field("cases", Lite(&_val.cases)); } formatter.finish() } - syn::Pat::Path(_val) => { - let mut formatter = formatter.debug_struct("Pat::Path"); + syn::Pat::Paren(_val) => { + let mut formatter = formatter.debug_struct("Pat::Paren"); 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.field("pat", Lite(&_val.pat)); formatter.finish() } + syn::Pat::Path(_val) => { + formatter.write_str("Pat::Path")?; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) + } syn::Pat::Range(_val) => { - let mut formatter = formatter.debug_struct("Pat::Range"); - if !_val.attrs.is_empty() { - formatter.field("attrs", Lite(&_val.attrs)); - } - formatter.field("lo", Lite(&_val.lo)); - formatter.field("limits", Lite(&_val.limits)); - formatter.field("hi", Lite(&_val.hi)); - formatter.finish() + formatter.write_str("Pat::Range")?; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) } syn::Pat::Reference(_val) => { let mut formatter = formatter.debug_struct("Pat::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)); + if _val.mutability.is_some() { + formatter.field("mutability", &Present); } formatter.field("pat", Lite(&_val.pat)); formatter.finish() @@ -3832,21 +3190,37 @@ impl Debug for Lite<syn::Pat> { 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(")?; + Debug::fmt(Lite(&self.0), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + } + formatter.field("qself", Print::ref_cast(val)); + } formatter.field("path", Lite(&_val.path)); if !_val.fields.is_empty() { formatter.field("fields", Lite(&_val.fields)); } - if let Some(val) = &_val.dot2_token { + if let Some(val) = &_val.rest { #[derive(RefCast)] #[repr(transparent)] - struct Print(syn::token::Dot2); + struct Print(syn::PatRest); impl Debug for Print { fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - formatter.write_str("Some")?; + formatter.write_str("Some(")?; + Debug::fmt(Lite(&self.0), formatter)?; + formatter.write_str(")")?; Ok(()) } } - formatter.field("dot2_token", Print::ref_cast(val)); + formatter.field("rest", Print::ref_cast(val)); } formatter.finish() } @@ -3865,8 +3239,24 @@ impl Debug for Lite<syn::Pat> { 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(")?; + Debug::fmt(Lite(&self.0), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + } + formatter.field("qself", Print::ref_cast(val)); + } formatter.field("path", Lite(&_val.path)); - formatter.field("pat", Lite(&_val.pat)); + if !_val.elems.is_empty() { + formatter.field("elems", Lite(&_val.elems)); + } formatter.finish() } syn::Pat::Type(_val) => { @@ -3879,7 +3269,7 @@ impl Debug for Lite<syn::Pat> { formatter.finish() } syn::Pat::Verbatim(_val) => { - formatter.write_str("Verbatim")?; + formatter.write_str("Pat::Verbatim")?; formatter.write_str("(`")?; Display::fmt(_val, formatter)?; formatter.write_str("`)")?; @@ -3896,59 +3286,27 @@ impl Debug for Lite<syn::Pat> { } } } -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"); - if !_val.attrs.is_empty() { - formatter.field("attrs", Lite(&_val.attrs)); - } - 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 !_val.attrs.is_empty() { - formatter.field("attrs", Lite(&_val.attrs)); + if !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.attrs)); } - 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 self.value.by_ref.is_some() { + formatter.field("by_ref", &Present); } - 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)); + if self.value.mutability.is_some() { + formatter.field("mutability", &Present); } - formatter.field("ident", Lite(&_val.ident)); - if let Some(val) = &_val.subpat { + formatter.field("ident", Lite(&self.value.ident)); + if let Some(val) = &self.value.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("Some(")?; + Debug::fmt(Lite(&self.0.1), formatter)?; formatter.write_str(")")?; Ok(()) } @@ -3958,253 +3316,186 @@ impl Debug for Lite<syn::PatIdent> { 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"); - if !_val.attrs.is_empty() { - formatter.field("attrs", Lite(&_val.attrs)); - } - 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"); - if !_val.attrs.is_empty() { - formatter.field("attrs", Lite(&_val.attrs)); - } - formatter.field("mac", Lite(&_val.mac)); - formatter.finish() - } -} impl Debug for Lite<syn::PatOr> { fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - let _val = &self.value; let mut formatter = formatter.debug_struct("PatOr"); - if !_val.attrs.is_empty() { - formatter.field("attrs", Lite(&_val.attrs)); + if !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.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 self.value.leading_vert.is_some() { + formatter.field("leading_vert", &Present); } - if !_val.cases.is_empty() { - formatter.field("cases", Lite(&_val.cases)); + if !self.value.cases.is_empty() { + formatter.field("cases", Lite(&self.value.cases)); } formatter.finish() } } -impl Debug for Lite<syn::PatPath> { +impl Debug for Lite<syn::PatParen> { fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - let _val = &self.value; - let mut formatter = formatter.debug_struct("PatPath"); - if !_val.attrs.is_empty() { - formatter.field("attrs", Lite(&_val.attrs)); + let mut formatter = formatter.debug_struct("PatParen"); + if !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.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::PatRange> { - fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - let _val = &self.value; - let mut formatter = formatter.debug_struct("PatRange"); - if !_val.attrs.is_empty() { - formatter.field("attrs", Lite(&_val.attrs)); - } - formatter.field("lo", Lite(&_val.lo)); - formatter.field("limits", Lite(&_val.limits)); - formatter.field("hi", Lite(&_val.hi)); + formatter.field("pat", Lite(&self.value.pat)); formatter.finish() } } impl Debug for Lite<syn::PatReference> { fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - let _val = &self.value; let mut formatter = formatter.debug_struct("PatReference"); - if !_val.attrs.is_empty() { - formatter.field("attrs", Lite(&_val.attrs)); + if !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.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)); + if self.value.mutability.is_some() { + formatter.field("mutability", &Present); } - formatter.field("pat", Lite(&_val.pat)); + formatter.field("pat", Lite(&self.value.pat)); formatter.finish() } } impl Debug for Lite<syn::PatRest> { fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - let _val = &self.value; let mut formatter = formatter.debug_struct("PatRest"); - if !_val.attrs.is_empty() { - formatter.field("attrs", Lite(&_val.attrs)); + if !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.attrs)); } 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.attrs.is_empty() { - formatter.field("attrs", Lite(&_val.attrs)); + if !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.attrs)); } - if !_val.elems.is_empty() { - formatter.field("elems", Lite(&_val.elems)); + if !self.value.elems.is_empty() { + formatter.field("elems", Lite(&self.value.elems)); } 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"); - if !_val.attrs.is_empty() { - formatter.field("attrs", Lite(&_val.attrs)); + if !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.attrs)); } - formatter.field("path", Lite(&_val.path)); - if !_val.fields.is_empty() { - formatter.field("fields", Lite(&_val.fields)); + if let Some(val) = &self.value.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(")?; + Debug::fmt(Lite(&self.0), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + } + formatter.field("qself", Print::ref_cast(val)); } - if let Some(val) = &_val.dot2_token { + formatter.field("path", Lite(&self.value.path)); + if !self.value.fields.is_empty() { + formatter.field("fields", Lite(&self.value.fields)); + } + if let Some(val) = &self.value.rest { #[derive(RefCast)] #[repr(transparent)] - struct Print(syn::token::Dot2); + struct Print(syn::PatRest); impl Debug for Print { fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - formatter.write_str("Some")?; + formatter.write_str("Some(")?; + Debug::fmt(Lite(&self.0), formatter)?; + formatter.write_str(")")?; Ok(()) } } - formatter.field("dot2_token", Print::ref_cast(val)); + formatter.field("rest", 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.attrs.is_empty() { - formatter.field("attrs", Lite(&_val.attrs)); + if !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.attrs)); } - if !_val.elems.is_empty() { - formatter.field("elems", Lite(&_val.elems)); + if !self.value.elems.is_empty() { + formatter.field("elems", Lite(&self.value.elems)); } 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"); - if !_val.attrs.is_empty() { - formatter.field("attrs", Lite(&_val.attrs)); + if !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.attrs)); + } + if let Some(val) = &self.value.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(")?; + Debug::fmt(Lite(&self.0), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + } + formatter.field("qself", Print::ref_cast(val)); + } + formatter.field("path", Lite(&self.value.path)); + if !self.value.elems.is_empty() { + formatter.field("elems", Lite(&self.value.elems)); } - formatter.field("path", Lite(&_val.path)); - formatter.field("pat", Lite(&_val.pat)); formatter.finish() } } impl Debug for Lite<syn::PatType> { fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - let _val = &self.value; let mut formatter = formatter.debug_struct("PatType"); - if !_val.attrs.is_empty() { - formatter.field("attrs", Lite(&_val.attrs)); + if !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.attrs)); } - formatter.field("pat", Lite(&_val.pat)); - formatter.field("ty", Lite(&_val.ty)); + formatter.field("pat", Lite(&self.value.pat)); + formatter.field("ty", Lite(&self.value.ty)); 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"); - if !_val.attrs.is_empty() { - formatter.field("attrs", Lite(&_val.attrs)); + if !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.attrs)); } 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 self.value.leading_colon.is_some() { + formatter.field("leading_colon", &Present); } - if !_val.segments.is_empty() { - formatter.field("segments", Lite(&_val.segments)); + if !self.value.segments.is_empty() { + formatter.field("segments", Lite(&self.value.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"), + match &self.value { + syn::PathArguments::None => formatter.write_str("PathArguments::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.colon2_token.is_some() { + formatter.field("colon2_token", &Present); } if !_val.args.is_empty() { formatter.field("args", Lite(&_val.args)); @@ -4225,91 +3516,71 @@ impl Debug for Lite<syn::PathArguments> { } 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.field("ident", Lite(&self.value.ident)); + match self.value.arguments { + syn::PathArguments::None => {} + _ => { + formatter.field("arguments", Lite(&self.value.arguments)); + } + } 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.field("lifetime", Lite(&self.value.lifetime)); + if !self.value.bounds.is_empty() { + formatter.field("bounds", Lite(&self.value.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 { + if let Some(val) = &self.value.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("Some(")?; + Debug::fmt(Lite(&self.0), 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.field("bounded_ty", Lite(&self.value.bounded_ty)); + if !self.value.bounds.is_empty() { + formatter.field("bounds", Lite(&self.value.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.field("ty", Lite(&self.value.ty)); + formatter.field("position", Lite(&self.value.position)); + if self.value.as_token.is_some() { + formatter.field("as_token", &Present); } formatter.finish() } } impl Debug for Lite<syn::RangeLimits> { fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - let _val = &self.value; - match _val { + match &self.value { syn::RangeLimits::HalfOpen(_val) => { - formatter.write_str("HalfOpen")?; + formatter.write_str("RangeLimits::HalfOpen")?; Ok(()) } syn::RangeLimits::Closed(_val) => { - formatter.write_str("Closed")?; + formatter.write_str("RangeLimits::Closed")?; Ok(()) } } @@ -4317,20 +3588,17 @@ impl Debug for Lite<syn::RangeLimits> { } impl Debug for Lite<syn::Receiver> { fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - let _val = &self.value; let mut formatter = formatter.debug_struct("Receiver"); - if !_val.attrs.is_empty() { - formatter.field("attrs", Lite(&_val.attrs)); + if !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.attrs)); } - if let Some(val) = &_val.reference { + if let Some(val) = &self.value.reference { #[derive(RefCast)] #[repr(transparent)] struct Print((syn::token::And, Option<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("(")?; + formatter.write_str("Some(")?; Debug::fmt( { #[derive(RefCast)] @@ -4343,8 +3611,7 @@ impl Debug for Lite<syn::Receiver> { ) -> fmt::Result { match &self.0 { Some(_val) => { - formatter.write_str("Some")?; - formatter.write_str("(")?; + formatter.write_str("Some(")?; Debug::fmt(Lite(_val), formatter)?; formatter.write_str(")")?; Ok(()) @@ -4353,7 +3620,7 @@ impl Debug for Lite<syn::Receiver> { } } } - Print::ref_cast(&_val.1) + Print::ref_cast(&self.0.1) }, formatter, )?; @@ -4363,28 +3630,22 @@ impl Debug for Lite<syn::Receiver> { } formatter.field("reference", 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)); + if self.value.mutability.is_some() { + formatter.field("mutability", &Present); } + if self.value.colon_token.is_some() { + formatter.field("colon_token", &Present); + } + formatter.field("ty", Lite(&self.value.ty)); formatter.finish() } } 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"), + match &self.value { + syn::ReturnType::Default => formatter.write_str("ReturnType::Default"), syn::ReturnType::Type(_v0, _v1) => { - let mut formatter = formatter.debug_tuple("Type"); + let mut formatter = formatter.debug_tuple("ReturnType::Type"); formatter.field(Lite(_v1)); formatter.finish() } @@ -4393,162 +3654,173 @@ impl Debug for Lite<syn::ReturnType> { } impl Debug for Lite<syn::Signature> { fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - let _val = &self.value; let mut formatter = formatter.debug_struct("Signature"); - 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 self.value.constness.is_some() { + formatter.field("constness", &Present); } - 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 self.value.asyncness.is_some() { + formatter.field("asyncness", &Present); } - 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 self.value.unsafety.is_some() { + formatter.field("unsafety", &Present); } - if let Some(val) = &_val.abi { + if let Some(val) = &self.value.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("Some(")?; + Debug::fmt(Lite(&self.0), formatter)?; formatter.write_str(")")?; Ok(()) } } formatter.field("abi", Print::ref_cast(val)); } - formatter.field("ident", Lite(&_val.ident)); - formatter.field("generics", Lite(&_val.generics)); - if !_val.inputs.is_empty() { - formatter.field("inputs", Lite(&_val.inputs)); + formatter.field("ident", Lite(&self.value.ident)); + formatter.field("generics", Lite(&self.value.generics)); + if !self.value.inputs.is_empty() { + formatter.field("inputs", Lite(&self.value.inputs)); } - if let Some(val) = &_val.variadic { + if let Some(val) = &self.value.variadic { #[derive(RefCast)] #[repr(transparent)] struct Print(syn::Variadic); 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("Some(")?; + Debug::fmt(Lite(&self.0), formatter)?; formatter.write_str(")")?; Ok(()) } } formatter.field("variadic", Print::ref_cast(val)); } - formatter.field("output", Lite(&_val.output)); + formatter.field("output", Lite(&self.value.output)); formatter.finish() } } +impl Debug for Lite<syn::StaticMutability> { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + match &self.value { + syn::StaticMutability::Mut(_val) => { + formatter.write_str("StaticMutability::Mut")?; + Ok(()) + } + syn::StaticMutability::None => formatter.write_str("StaticMutability::None"), + _ => unreachable!(), + } + } +} impl Debug for Lite<syn::Stmt> { fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - let _val = &self.value; - match _val { + match &self.value { syn::Stmt::Local(_val) => { - formatter.write_str("Local")?; - formatter.write_str("(")?; - Debug::fmt(Lite(_val), formatter)?; - formatter.write_str(")")?; - Ok(()) + let mut formatter = formatter.debug_struct("Stmt::Local"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("pat", Lite(&_val.pat)); + if let Some(val) = &_val.init { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::LocalInit); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some(")?; + Debug::fmt(Lite(&self.0), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + } + formatter.field("init", Print::ref_cast(val)); + } + formatter.finish() } 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("Stmt::Item")?; formatter.write_str("(")?; Debug::fmt(Lite(_val), formatter)?; formatter.write_str(")")?; Ok(()) } - syn::Stmt::Semi(_v0, _v1) => { - let mut formatter = formatter.debug_tuple("Semi"); + syn::Stmt::Expr(_v0, _v1) => { + let mut formatter = formatter.debug_tuple("Stmt::Expr"); formatter.field(Lite(_v0)); + formatter + .field( + &super::Option { + present: _v1.is_some(), + }, + ); formatter.finish() } + syn::Stmt::Macro(_val) => { + let mut formatter = formatter.debug_struct("Stmt::Macro"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("mac", Lite(&_val.mac)); + if _val.semi_token.is_some() { + formatter.field("semi_token", &Present); + } + formatter.finish() + } + } + } +} +impl Debug for Lite<syn::StmtMacro> { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("StmtMacro"); + if !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.attrs)); + } + formatter.field("mac", Lite(&self.value.mac)); + if self.value.semi_token.is_some() { + formatter.field("semi_token", &Present); } + 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(()) - } + if self.value.paren_token.is_some() { + formatter.field("paren_token", &Present); + } + match self.value.modifier { + syn::TraitBoundModifier::None => {} + _ => { + formatter.field("modifier", Lite(&self.value.modifier)); } - formatter.field("paren_token", Print::ref_cast(val)); } - formatter.field("modifier", Lite(&_val.modifier)); - if let Some(val) = &_val.lifetimes { + if let Some(val) = &self.value.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("Some(")?; + Debug::fmt(Lite(&self.0), formatter)?; formatter.write_str(")")?; Ok(()) } } formatter.field("lifetimes", Print::ref_cast(val)); } - formatter.field("path", Lite(&_val.path)); + formatter.field("path", Lite(&self.value.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"), + match &self.value { + syn::TraitBoundModifier::None => { + formatter.write_str("TraitBoundModifier::None") + } syn::TraitBoundModifier::Maybe(_val) => { - formatter.write_str("Maybe")?; + formatter.write_str("TraitBoundModifier::Maybe")?; Ok(()) } } @@ -4556,14 +3828,14 @@ impl Debug for Lite<syn::TraitBoundModifier> { } impl Debug for Lite<syn::TraitItem> { fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - let _val = &self.value; - match _val { + match &self.value { 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("generics", Lite(&_val.generics)); formatter.field("ty", Lite(&_val.ty)); if let Some(val) = &_val.default { #[derive(RefCast)] @@ -4571,10 +3843,8 @@ impl Debug for Lite<syn::TraitItem> { 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("Some(")?; + Debug::fmt(Lite(&self.0.1), formatter)?; formatter.write_str(")")?; Ok(()) } @@ -4583,8 +3853,8 @@ impl Debug for Lite<syn::TraitItem> { } formatter.finish() } - syn::TraitItem::Method(_val) => { - let mut formatter = formatter.debug_struct("TraitItem::Method"); + syn::TraitItem::Fn(_val) => { + let mut formatter = formatter.debug_struct("TraitItem::Fn"); if !_val.attrs.is_empty() { formatter.field("attrs", Lite(&_val.attrs)); } @@ -4595,27 +3865,16 @@ impl Debug for Lite<syn::TraitItem> { 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("Some(")?; + Debug::fmt(Lite(&self.0), 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)); + if _val.semi_token.is_some() { + formatter.field("semi_token", &Present); } formatter.finish() } @@ -4626,17 +3885,8 @@ impl Debug for Lite<syn::TraitItem> { } 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.colon_token.is_some() { + formatter.field("colon_token", &Present); } if !_val.bounds.is_empty() { formatter.field("bounds", Lite(&_val.bounds)); @@ -4647,10 +3897,8 @@ impl Debug for Lite<syn::TraitItem> { 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("Some(")?; + Debug::fmt(Lite(&self.0.1), formatter)?; formatter.write_str(")")?; Ok(()) } @@ -4665,22 +3913,13 @@ impl Debug for Lite<syn::TraitItem> { 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)); + if _val.semi_token.is_some() { + formatter.field("semi_token", &Present); } formatter.finish() } syn::TraitItem::Verbatim(_val) => { - formatter.write_str("Verbatim")?; + formatter.write_str("TraitItem::Verbatim")?; formatter.write_str("(`")?; Display::fmt(_val, formatter)?; formatter.write_str("`)")?; @@ -4692,23 +3931,21 @@ impl Debug for Lite<syn::TraitItem> { } 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)); + if !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.attrs)); } - formatter.field("ident", Lite(&_val.ident)); - formatter.field("ty", Lite(&_val.ty)); - if let Some(val) = &_val.default { + formatter.field("ident", Lite(&self.value.ident)); + formatter.field("generics", Lite(&self.value.generics)); + formatter.field("ty", Lite(&self.value.ty)); + if let Some(val) = &self.value.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("Some(")?; + Debug::fmt(Lite(&self.0.1), formatter)?; formatter.write_str(")")?; Ok(()) } @@ -4718,102 +3955,68 @@ impl Debug for Lite<syn::TraitItemConst> { formatter.finish() } } -impl Debug for Lite<syn::TraitItemMacro> { +impl Debug for Lite<syn::TraitItemFn> { 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)); + let mut formatter = formatter.debug_struct("TraitItemFn"); + if !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.attrs)); } - formatter.field("mac", Lite(&_val.mac)); - if let Some(val) = &_val.semi_token { + formatter.field("sig", Lite(&self.value.sig)); + if let Some(val) = &self.value.default { #[derive(RefCast)] #[repr(transparent)] - struct Print(syn::token::Semi); + struct Print(syn::Block); impl Debug for Print { fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - formatter.write_str("Some")?; + formatter.write_str("Some(")?; + Debug::fmt(Lite(&self.0), formatter)?; + formatter.write_str(")")?; Ok(()) } } - formatter.field("semi_token", Print::ref_cast(val)); + formatter.field("default", Print::ref_cast(val)); + } + if self.value.semi_token.is_some() { + formatter.field("semi_token", &Present); } formatter.finish() } } -impl Debug for Lite<syn::TraitItemMethod> { +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("TraitItemMethod"); - if !_val.attrs.is_empty() { - formatter.field("attrs", Lite(&_val.attrs)); + let mut formatter = formatter.debug_struct("TraitItemMacro"); + if !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.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.field("mac", Lite(&self.value.mac)); + if self.value.semi_token.is_some() { + formatter.field("semi_token", &Present); } 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)); + if !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.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)); + formatter.field("ident", Lite(&self.value.ident)); + formatter.field("generics", Lite(&self.value.generics)); + if self.value.colon_token.is_some() { + formatter.field("colon_token", &Present); } - if !_val.bounds.is_empty() { - formatter.field("bounds", Lite(&_val.bounds)); + if !self.value.bounds.is_empty() { + formatter.field("bounds", Lite(&self.value.bounds)); } - if let Some(val) = &_val.default { + if let Some(val) = &self.value.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("Some(")?; + Debug::fmt(Lite(&self.0.1), formatter)?; formatter.write_str(")")?; Ok(()) } @@ -4825,8 +4028,7 @@ impl Debug for Lite<syn::TraitItemType> { } impl Debug for Lite<syn::Type> { fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - let _val = &self.value; - match _val { + match &self.value { syn::Type::Array(_val) => { let mut formatter = formatter.debug_struct("Type::Array"); formatter.field("elem", Lite(&_val.elem)); @@ -4841,27 +4043,16 @@ impl Debug for Lite<syn::Type> { 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("Some(")?; + Debug::fmt(Lite(&self.0), 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 _val.unsafety.is_some() { + formatter.field("unsafety", &Present); } if let Some(val) = &_val.abi { #[derive(RefCast)] @@ -4869,10 +4060,8 @@ impl Debug for Lite<syn::Type> { 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("Some(")?; + Debug::fmt(Lite(&self.0), formatter)?; formatter.write_str(")")?; Ok(()) } @@ -4885,13 +4074,11 @@ impl Debug for Lite<syn::Type> { if let Some(val) = &_val.variadic { #[derive(RefCast)] #[repr(transparent)] - struct Print(syn::Variadic); + struct Print(syn::BareVariadic); 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("Some(")?; + Debug::fmt(Lite(&self.0), formatter)?; formatter.write_str(")")?; Ok(()) } @@ -4939,10 +4126,8 @@ impl Debug for Lite<syn::Type> { 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("Some(")?; + Debug::fmt(Lite(&self.0), formatter)?; formatter.write_str(")")?; Ok(()) } @@ -4954,29 +4139,11 @@ impl Debug for Lite<syn::Type> { } 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 _val.const_token.is_some() { + formatter.field("const_token", &Present); } - 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)); + if _val.mutability.is_some() { + formatter.field("mutability", &Present); } formatter.field("elem", Lite(&_val.elem)); formatter.finish() @@ -4989,27 +4156,16 @@ impl Debug for Lite<syn::Type> { 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("Some(")?; + Debug::fmt(Lite(&self.0), 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)); + if _val.mutability.is_some() { + formatter.field("mutability", &Present); } formatter.field("elem", Lite(&_val.elem)); formatter.finish() @@ -5021,17 +4177,8 @@ impl Debug for Lite<syn::Type> { } 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.dyn_token.is_some() { + formatter.field("dyn_token", &Present); } if !_val.bounds.is_empty() { formatter.field("bounds", Lite(&_val.bounds)); @@ -5046,7 +4193,7 @@ impl Debug for Lite<syn::Type> { formatter.finish() } syn::Type::Verbatim(_val) => { - formatter.write_str("Verbatim")?; + formatter.write_str("Type::Verbatim")?; formatter.write_str("(`")?; Display::fmt(_val, formatter)?; formatter.write_str("`)")?; @@ -5058,169 +4205,126 @@ impl Debug for Lite<syn::Type> { } 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.field("elem", Lite(&self.value.elem)); + formatter.field("len", Lite(&self.value.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 { + if let Some(val) = &self.value.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("Some(")?; + Debug::fmt(Lite(&self.0), 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 self.value.unsafety.is_some() { + formatter.field("unsafety", &Present); } - if let Some(val) = &_val.abi { + if let Some(val) = &self.value.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("Some(")?; + Debug::fmt(Lite(&self.0), formatter)?; formatter.write_str(")")?; Ok(()) } } formatter.field("abi", Print::ref_cast(val)); } - if !_val.inputs.is_empty() { - formatter.field("inputs", Lite(&_val.inputs)); + if !self.value.inputs.is_empty() { + formatter.field("inputs", Lite(&self.value.inputs)); } - if let Some(val) = &_val.variadic { + if let Some(val) = &self.value.variadic { #[derive(RefCast)] #[repr(transparent)] - struct Print(syn::Variadic); + struct Print(syn::BareVariadic); 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("Some(")?; + Debug::fmt(Lite(&self.0), formatter)?; formatter.write_str(")")?; Ok(()) } } formatter.field("variadic", Print::ref_cast(val)); } - formatter.field("output", Lite(&_val.output)); + formatter.field("output", Lite(&self.value.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.field("elem", Lite(&self.value.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)); + if !self.value.bounds.is_empty() { + formatter.field("bounds", Lite(&self.value.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.field("mac", Lite(&self.value.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)); + if !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.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)); + formatter.field("ident", Lite(&self.value.ident)); + if self.value.colon_token.is_some() { + formatter.field("colon_token", &Present); } - if !_val.bounds.is_empty() { - formatter.field("bounds", Lite(&_val.bounds)); + if !self.value.bounds.is_empty() { + formatter.field("bounds", Lite(&self.value.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 self.value.eq_token.is_some() { + formatter.field("eq_token", &Present); } - if let Some(val) = &_val.default { + if let Some(val) = &self.value.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("Some(")?; + Debug::fmt(Lite(&self.0), formatter)?; formatter.write_str(")")?; Ok(()) } @@ -5232,261 +4336,213 @@ impl Debug for Lite<syn::TypeParam> { } impl Debug for Lite<syn::TypeParamBound> { fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - let _val = &self.value; - match _val { + match &self.value { syn::TypeParamBound::Trait(_val) => { - formatter.write_str("Trait")?; + formatter.write_str("TypeParamBound::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(")")?; + let mut formatter = formatter.debug_struct("TypeParamBound::Lifetime"); + formatter.field("ident", Lite(&_val.ident)); + formatter.finish() + } + syn::TypeParamBound::Verbatim(_val) => { + formatter.write_str("TypeParamBound::Verbatim")?; + formatter.write_str("(`")?; + Display::fmt(_val, formatter)?; + formatter.write_str("`)")?; Ok(()) } + _ => unreachable!(), } } } 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.field("elem", Lite(&self.value.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 { + if let Some(val) = &self.value.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("Some(")?; + Debug::fmt(Lite(&self.0), formatter)?; formatter.write_str(")")?; Ok(()) } } formatter.field("qself", Print::ref_cast(val)); } - formatter.field("path", Lite(&_val.path)); + formatter.field("path", Lite(&self.value.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 self.value.const_token.is_some() { + formatter.field("const_token", &Present); } - 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)); + if self.value.mutability.is_some() { + formatter.field("mutability", &Present); } - formatter.field("elem", Lite(&_val.elem)); + formatter.field("elem", Lite(&self.value.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 { + if let Some(val) = &self.value.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("Some(")?; + Debug::fmt(Lite(&self.0), 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)); + if self.value.mutability.is_some() { + formatter.field("mutability", &Present); } - formatter.field("elem", Lite(&_val.elem)); + formatter.field("elem", Lite(&self.value.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.field("elem", Lite(&self.value.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 self.value.dyn_token.is_some() { + formatter.field("dyn_token", &Present); } - if !_val.bounds.is_empty() { - formatter.field("bounds", Lite(&_val.bounds)); + if !self.value.bounds.is_empty() { + formatter.field("bounds", Lite(&self.value.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)); + if !self.value.elems.is_empty() { + formatter.field("elems", Lite(&self.value.elems)); } formatter.finish() } } impl Debug for Lite<syn::UnOp> { fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - let _val = &self.value; - match _val { + match &self.value { syn::UnOp::Deref(_val) => { - formatter.write_str("Deref")?; + formatter.write_str("UnOp::Deref")?; Ok(()) } syn::UnOp::Not(_val) => { - formatter.write_str("Not")?; + formatter.write_str("UnOp::Not")?; Ok(()) } syn::UnOp::Neg(_val) => { - formatter.write_str("Neg")?; + formatter.write_str("UnOp::Neg")?; Ok(()) } + _ => unreachable!(), } } } 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)); + if !self.value.items.is_empty() { + formatter.field("items", Lite(&self.value.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.field("ident", Lite(&self.value.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.field("ident", Lite(&self.value.ident)); + formatter.field("tree", Lite(&self.value.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.field("ident", Lite(&self.value.ident)); + formatter.field("rename", Lite(&self.value.rename)); formatter.finish() } } impl Debug for Lite<syn::UseTree> { fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - let _val = &self.value; - match _val { + match &self.value { syn::UseTree::Path(_val) => { - formatter.write_str("Path")?; + formatter.write_str("UseTree::Path")?; formatter.write_str("(")?; Debug::fmt(Lite(_val), formatter)?; formatter.write_str(")")?; Ok(()) } syn::UseTree::Name(_val) => { - formatter.write_str("Name")?; + formatter.write_str("UseTree::Name")?; formatter.write_str("(")?; Debug::fmt(Lite(_val), formatter)?; formatter.write_str(")")?; Ok(()) } syn::UseTree::Rename(_val) => { - formatter.write_str("Rename")?; + formatter.write_str("UseTree::Rename")?; formatter.write_str("(")?; Debug::fmt(Lite(_val), formatter)?; formatter.write_str(")")?; Ok(()) } syn::UseTree::Glob(_val) => { - formatter.write_str("Glob")?; + formatter.write_str("UseTree::Glob")?; formatter.write_str("(")?; Debug::fmt(Lite(_val), formatter)?; formatter.write_str(")")?; Ok(()) } syn::UseTree::Group(_val) => { - formatter.write_str("Group")?; + formatter.write_str("UseTree::Group")?; formatter.write_str("(")?; Debug::fmt(Lite(_val), formatter)?; formatter.write_str(")")?; @@ -5497,33 +4553,46 @@ impl Debug for Lite<syn::UseTree> { } impl Debug for Lite<syn::Variadic> { fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - let _val = &self.value; let mut formatter = formatter.debug_struct("Variadic"); - if !_val.attrs.is_empty() { - formatter.field("attrs", Lite(&_val.attrs)); + if !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.attrs)); + } + if let Some(val) = &self.value.pat { + #[derive(RefCast)] + #[repr(transparent)] + struct Print((Box<syn::Pat>, syn::token::Colon)); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some(")?; + Debug::fmt(Lite(&self.0.0), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + } + formatter.field("pat", Print::ref_cast(val)); + } + if self.value.comma.is_some() { + formatter.field("comma", &Present); } formatter.finish() } } 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)); + if !self.value.attrs.is_empty() { + formatter.field("attrs", Lite(&self.value.attrs)); } - formatter.field("ident", Lite(&_val.ident)); - formatter.field("fields", Lite(&_val.fields)); - if let Some(val) = &_val.discriminant { + formatter.field("ident", Lite(&self.value.ident)); + formatter.field("fields", Lite(&self.value.fields)); + if let Some(val) = &self.value.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("Some(")?; + Debug::fmt(Lite(&self.0.1), formatter)?; formatter.write_str(")")?; Ok(()) } @@ -5533,108 +4602,62 @@ impl Debug for Lite<syn::Variant> { 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)); + if self.value.in_token.is_some() { + formatter.field("in_token", &Present); } - formatter.field("path", Lite(&_val.path)); + formatter.field("path", Lite(&self.value.path)); formatter.finish() } } impl Debug for Lite<syn::Visibility> { fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - let _val = &self.value; - match _val { + match &self.value { 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() + formatter.write_str("Visibility::Public")?; + Ok(()) } 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)); + if _val.in_token.is_some() { + formatter.field("in_token", &Present); } formatter.field("path", Lite(&_val.path)); formatter.finish() } - syn::Visibility::Inherited => formatter.write_str("Inherited"), + syn::Visibility::Inherited => formatter.write_str("Visibility::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)); + if !self.value.predicates.is_empty() { + formatter.field("predicates", Lite(&self.value.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(()) - } + match &self.value { syn::WherePredicate::Lifetime(_val) => { - formatter.write_str("Lifetime")?; + formatter.write_str("WherePredicate::Lifetime")?; formatter.write_str("(")?; Debug::fmt(Lite(_val), formatter)?; formatter.write_str(")")?; Ok(()) } - syn::WherePredicate::Eq(_val) => { - formatter.write_str("Eq")?; + syn::WherePredicate::Type(_val) => { + formatter.write_str("WherePredicate::Type")?; formatter.write_str("(")?; Debug::fmt(Lite(_val), formatter)?; formatter.write_str(")")?; Ok(()) } + _ => unreachable!(), } } } diff --git a/vendor/syn/tests/debug/mod.rs b/vendor/syn/tests/debug/mod.rs index 0a0991a92..caf9eed80 100644 --- a/vendor/syn/tests/debug/mod.rs +++ b/vendor/syn/tests/debug/mod.rs @@ -123,3 +123,21 @@ where .finish() } } + +struct Present; + +impl Debug for Present { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some") + } +} + +struct Option { + present: bool, +} + +impl Debug for Option { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str(if self.present { "Some" } else { "None" }) + } +} |