| 1 | use proc_macro2rust-analyzer cargo proc-macro2 1.0.107 crate/::TokenStreamrust-analyzer cargo proc-macro2 1.0.107 TokenStream#; |
| 2 | use quoterust-analyzer cargo quote 1.0.47 crate/::quoterust-analyzer cargo quote 1.0.47 quote!; |
| 3 | use synrust-analyzer cargo syn 1.0.109 crate/::parserust-analyzer cargo syn 1.0.109 parse/::{Parserust-analyzer cargo syn 1.0.109 parse/Parse#, ParseStreamrust-analyzer cargo syn 1.0.109 parse/ParseStream#, Parserrust-analyzer cargo syn 1.0.109 parse/Parser#}; |
| 4 | use synrust-analyzer cargo syn 1.0.109 crate/::punctuatedrust-analyzer cargo syn 1.0.109 punctuated/::Punctuatedrust-analyzer cargo syn 1.0.109 punctuated/Punctuated#; |
| 5 | use synrust-analyzer cargo syn 1.0.109 crate/::{parenthesizedrust-analyzer cargo syn 1.0.109 group/parenthesized!, Attributerust-analyzer cargo syn 1.0.109 attr/Attribute#, Errorrust-analyzer cargo syn 1.0.109 error/Error#, Pathrust-analyzer cargo syn 1.0.109 path/Path#, Resultrust-analyzer cargo syn 1.0.109 error/Result#, Tokenrust-analyzer cargo syn 1.0.109 token/Token!}; |
| 6 | |
| 7 | use craterust-analyzer cargo ghost 0.1.5 crate/::parserust-analyzer cargo ghost 0.1.5 parse/::UnitStructrust-analyzer cargo ghost 0.1.5 parse/UnitStruct#; |
| 8 | |
| 9 | enum Deriverust-analyzer cargo ghost 0.1.5 derive/Derive# { |
| 10 | Copyrust-analyzer cargo ghost 0.1.5 derive/Derive#Copy#, |
| 11 | Clonerust-analyzer cargo ghost 0.1.5 derive/Derive#Clone#, |
| 12 | Defaultrust-analyzer cargo ghost 0.1.5 derive/Derive#Default#, |
| 13 | Hashrust-analyzer cargo ghost 0.1.5 derive/Derive#Hash#, |
| 14 | PartialOrdrust-analyzer cargo ghost 0.1.5 derive/Derive#PartialOrd#, |
| 15 | Ordrust-analyzer cargo ghost 0.1.5 derive/Derive#Ord#, |
| 16 | PartialEqrust-analyzer cargo ghost 0.1.5 derive/Derive#PartialEq#, |
| 17 | Eqrust-analyzer cargo ghost 0.1.5 derive/Derive#Eq#, |
| 18 | Debugrust-analyzer cargo ghost 0.1.5 derive/Derive#Debug#, |
| 19 | } |
| 20 | |
| 21 | struct DeriveListrust-analyzer cargo ghost 0.1.5 derive/DeriveList# { |
| 22 | derivesrust-analyzer cargo ghost 0.1.5 derive/DeriveList#derives.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Deriverust-analyzer cargo ghost 0.1.5 derive/Derive#>, |
| 23 | } |
| 24 | |
| 25 | impl Parserust-analyzer cargo syn 1.0.109 parse/Parse# for DeriveListrust-analyzer cargo ghost 0.1.5 derive/DeriveList# { |
| 26 | fn parserust-analyzer cargo ghost 0.1.5 derive/impl#[DeriveList][Parse]parse().(input: ParseStreamrust-analyzer cargo syn 1.0.109 parse/ParseStream#) -> Resultrust-analyzer cargo syn 1.0.109 error/Result#<Selfrust-analyzer cargo ghost 0.1.5 derive/impl#[DeriveList][Parse]> { |
| 27 | let content; |
| 28 | parenthesizedrust-analyzer cargo syn 1.0.109 group/parenthesized!!(content in input); |
| 29 | let paths: Punctuatedrust-analyzer cargo syn 1.0.109 punctuated/Punctuated#<Pathrust-analyzer cargo syn 1.0.109 path/Path#, Tokenrust-analyzer cargo syn 1.0.109 token/Token!![,]> = content.parse_terminatedrust-analyzer cargo syn 1.0.109 parse/impl#[`ParseBuffer<'a>`]parse_terminated().(Pathrust-analyzer cargo syn 1.0.109 path/Path#::parse_mod_stylerust-analyzer cargo syn 1.0.109 path/parsing/impl#[Path]parse_mod_style().)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 30 | |
| 31 | let mut derives = Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().(); |
| 32 | for path in paths { |
| 33 | if path.is_identrust-analyzer cargo syn 1.0.109 path/parsing/impl#[Path]is_ident().("Copy") { |
| 34 | derives.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(Deriverust-analyzer cargo ghost 0.1.5 derive/Derive#::Copyrust-analyzer cargo ghost 0.1.5 derive/Derive#Copy#); |
| 35 | } else if path.is_identrust-analyzer cargo syn 1.0.109 path/parsing/impl#[Path]is_ident().("Clone") { |
| 36 | derives.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(Deriverust-analyzer cargo ghost 0.1.5 derive/Derive#::Clonerust-analyzer cargo ghost 0.1.5 derive/Derive#Clone#); |
| 37 | } else if path.is_identrust-analyzer cargo syn 1.0.109 path/parsing/impl#[Path]is_ident().("Default") { |
| 38 | derives.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(Deriverust-analyzer cargo ghost 0.1.5 derive/Derive#::Defaultrust-analyzer cargo ghost 0.1.5 derive/Derive#Default#); |
| 39 | } else if path.is_identrust-analyzer cargo syn 1.0.109 path/parsing/impl#[Path]is_ident().("Hash") { |
| 40 | derives.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(Deriverust-analyzer cargo ghost 0.1.5 derive/Derive#::Hashrust-analyzer cargo ghost 0.1.5 derive/Derive#Hash#); |
| 41 | } else if path.is_identrust-analyzer cargo syn 1.0.109 path/parsing/impl#[Path]is_ident().("PartialOrd") { |
| 42 | derives.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(Deriverust-analyzer cargo ghost 0.1.5 derive/Derive#::PartialOrdrust-analyzer cargo ghost 0.1.5 derive/Derive#PartialOrd#); |
| 43 | } else if path.is_identrust-analyzer cargo syn 1.0.109 path/parsing/impl#[Path]is_ident().("Ord") { |
| 44 | derives.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(Deriverust-analyzer cargo ghost 0.1.5 derive/Derive#::Ordrust-analyzer cargo ghost 0.1.5 derive/Derive#Ord#); |
| 45 | } else if path.is_identrust-analyzer cargo syn 1.0.109 path/parsing/impl#[Path]is_ident().("PartialEq") { |
| 46 | derives.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(Deriverust-analyzer cargo ghost 0.1.5 derive/Derive#::PartialEqrust-analyzer cargo ghost 0.1.5 derive/Derive#PartialEq#); |
| 47 | } else if path.is_identrust-analyzer cargo syn 1.0.109 path/parsing/impl#[Path]is_ident().("Eq") { |
| 48 | derives.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(Deriverust-analyzer cargo ghost 0.1.5 derive/Derive#::Eqrust-analyzer cargo ghost 0.1.5 derive/Derive#Eq#); |
| 49 | } else if path.is_identrust-analyzer cargo syn 1.0.109 path/parsing/impl#[Path]is_ident().("Debug") { |
| 50 | derives.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(Deriverust-analyzer cargo ghost 0.1.5 derive/Derive#::Debugrust-analyzer cargo ghost 0.1.5 derive/Derive#Debug#); |
| 51 | } else { |
| 52 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo syn 1.0.109 error/Error#::new_spannedrust-analyzer cargo syn 1.0.109 error/impl#[Error]new_spanned().(path, "unsupported derive")); |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(DeriveListrust-analyzer cargo ghost 0.1.5 derive/DeriveList# { derivesrust-analyzer cargo ghost 0.1.5 derive/DeriveList#derives. }) |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | pub fn expandrust-analyzer cargo ghost 0.1.5 derive/expand().<'a>( |
| 61 | attrs: &'a [Attributerust-analyzer cargo syn 1.0.109 attr/Attribute#], |
| 62 | input: &UnitStructrust-analyzer cargo ghost 0.1.5 parse/UnitStruct#, |
| 63 | ) -> Resultrust-analyzer cargo syn 1.0.109 error/Result#<(TokenStreamrust-analyzer cargo proc-macro2 1.0.107 TokenStream#, Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<&'a Attributerust-analyzer cargo syn 1.0.109 attr/Attribute#>)> { |
| 64 | let mut expanded = TokenStreamrust-analyzer cargo proc-macro2 1.0.107 TokenStream#::newrust-analyzer cargo proc-macro2 1.0.107 impl#[TokenStream]new().(); |
| 65 | let mut non_derives = Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().(); |
| 66 | |
| 67 | for attr in attrs { |
| 68 | if attr.pathrust-analyzer cargo syn 1.0.109 attr/Attribute#path..is_identrust-analyzer cargo syn 1.0.109 path/parsing/impl#[Path]is_ident().("derive") { |
| 69 | let list = DeriveListrust-analyzer cargo ghost 0.1.5 derive/DeriveList#::parserust-analyzer cargo ghost 0.1.5 derive/impl#[DeriveList][Parse]parse()..parse2rust-analyzer cargo syn 1.0.109 parse/impl#[F][Parser]parse2().(attr.tokensrust-analyzer cargo syn 1.0.109 attr/Attribute#tokens..clonerust-analyzer cargo proc-macro2 1.0.107 impl#[TokenStream][Clone]clone().())?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 70 | for derive in list.derivesrust-analyzer cargo ghost 0.1.5 derive/DeriveList#derives. { |
| 71 | expanded.extendrust-analyzer cargo proc-macro2 1.0.107 impl#[TokenStream][`Extend<TokenTree>`]extend().(applyrust-analyzer cargo ghost 0.1.5 derive/apply().(derive, input)); |
| 72 | } |
| 73 | } else { |
| 74 | non_derives.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(attr); |
| 75 | } |
| 76 | } |
| 77 | |
| 78 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#((expanded, non_derives)) |
| 79 | } |
| 80 | |
| 81 | fn applyrust-analyzer cargo ghost 0.1.5 derive/apply().(derive: Deriverust-analyzer cargo ghost 0.1.5 derive/Derive#, input: &UnitStructrust-analyzer cargo ghost 0.1.5 parse/UnitStruct#) -> TokenStreamrust-analyzer cargo proc-macro2 1.0.107 TokenStream# { |
| 82 | match derive { |
| 83 | Deriverust-analyzer cargo ghost 0.1.5 derive/Derive#::Copyrust-analyzer cargo ghost 0.1.5 derive/Derive#Copy# => expand_copyrust-analyzer cargo ghost 0.1.5 derive/expand_copy().(input), |
| 84 | Deriverust-analyzer cargo ghost 0.1.5 derive/Derive#::Clonerust-analyzer cargo ghost 0.1.5 derive/Derive#Clone# => expand_clonerust-analyzer cargo ghost 0.1.5 derive/expand_clone().(input), |
| 85 | Deriverust-analyzer cargo ghost 0.1.5 derive/Derive#::Defaultrust-analyzer cargo ghost 0.1.5 derive/Derive#Default# => expand_defaultrust-analyzer cargo ghost 0.1.5 derive/expand_default().(input), |
| 86 | Deriverust-analyzer cargo ghost 0.1.5 derive/Derive#::Hashrust-analyzer cargo ghost 0.1.5 derive/Derive#Hash# => expand_hashrust-analyzer cargo ghost 0.1.5 derive/expand_hash().(input), |
| 87 | Deriverust-analyzer cargo ghost 0.1.5 derive/Derive#::PartialOrdrust-analyzer cargo ghost 0.1.5 derive/Derive#PartialOrd# => expand_partialordrust-analyzer cargo ghost 0.1.5 derive/expand_partialord().(input), |
| 88 | Deriverust-analyzer cargo ghost 0.1.5 derive/Derive#::Ordrust-analyzer cargo ghost 0.1.5 derive/Derive#Ord# => expand_ordrust-analyzer cargo ghost 0.1.5 derive/expand_ord().(input), |
| 89 | Deriverust-analyzer cargo ghost 0.1.5 derive/Derive#::PartialEqrust-analyzer cargo ghost 0.1.5 derive/Derive#PartialEq# => expand_partialeqrust-analyzer cargo ghost 0.1.5 derive/expand_partialeq().(input), |
| 90 | Deriverust-analyzer cargo ghost 0.1.5 derive/Derive#::Eqrust-analyzer cargo ghost 0.1.5 derive/Derive#Eq# => expand_eqrust-analyzer cargo ghost 0.1.5 derive/expand_eq().(input), |
| 91 | Deriverust-analyzer cargo ghost 0.1.5 derive/Derive#::Debugrust-analyzer cargo ghost 0.1.5 derive/Derive#Debug# => expand_debugrust-analyzer cargo ghost 0.1.5 derive/expand_debug().(input), |
| 92 | } |
| 93 | } |
| 94 | |
| 95 | fn expand_copyrust-analyzer cargo ghost 0.1.5 derive/expand_copy().(input: &UnitStructrust-analyzer cargo ghost 0.1.5 parse/UnitStruct#) -> TokenStreamrust-analyzer cargo proc-macro2 1.0.107 TokenStream# { |
| 96 | let ident = &input.identrust-analyzer cargo ghost 0.1.5 parse/UnitStruct#ident.; |
| 97 | let (impl_generics, ty_generics, where_clause) = input.genericsrust-analyzer cargo ghost 0.1.5 parse/UnitStruct#generics..split_for_implrust-analyzer cargo syn 1.0.109 generics/impl#[Generics]split_for_impl().(); |
| 98 | |
| 99 | quoterust-analyzer cargo quote 1.0.47 quote!! { |
| 100 | impl #impl_generics ::core::marker::Copy |
| 101 | for #ident #ty_generics #where_clause {} |
| 102 | } |
| 103 | } |
| 104 | |
| 105 | fn expand_clonerust-analyzer cargo ghost 0.1.5 derive/expand_clone().(input: &UnitStructrust-analyzer cargo ghost 0.1.5 parse/UnitStruct#) -> TokenStreamrust-analyzer cargo proc-macro2 1.0.107 TokenStream# { |
| 106 | let ident = &input.identrust-analyzer cargo ghost 0.1.5 parse/UnitStruct#ident.; |
| 107 | let (impl_generics, ty_generics, where_clause) = input.genericsrust-analyzer cargo ghost 0.1.5 parse/UnitStruct#generics..split_for_implrust-analyzer cargo syn 1.0.109 generics/impl#[Generics]split_for_impl().(); |
| 108 | |
| 109 | quoterust-analyzer cargo quote 1.0.47 quote!! { |
| 110 | #[allow(clippy::expl_impl_clone_on_copy)] |
| 111 | impl #impl_generics ::core::clone::Clone |
| 112 | for #ident #ty_generics #where_clause { |
| 113 | #[inline] |
| 114 | fn clone(&self) -> Self { |
| 115 | #ident |
| 116 | } |
| 117 | } |
| 118 | } |
| 119 | } |
| 120 | |
| 121 | fn expand_defaultrust-analyzer cargo ghost 0.1.5 derive/expand_default().(input: &UnitStructrust-analyzer cargo ghost 0.1.5 parse/UnitStruct#) -> TokenStreamrust-analyzer cargo proc-macro2 1.0.107 TokenStream# { |
| 122 | let ident = &input.identrust-analyzer cargo ghost 0.1.5 parse/UnitStruct#ident.; |
| 123 | let (impl_generics, ty_generics, where_clause) = input.genericsrust-analyzer cargo ghost 0.1.5 parse/UnitStruct#generics..split_for_implrust-analyzer cargo syn 1.0.109 generics/impl#[Generics]split_for_impl().(); |
| 124 | |
| 125 | quoterust-analyzer cargo quote 1.0.47 quote!! { |
| 126 | impl #impl_generics ::core::default::Default |
| 127 | for #ident #ty_generics #where_clause { |
| 128 | #[inline] |
| 129 | fn default() -> Self { |
| 130 | #ident |
| 131 | } |
| 132 | } |
| 133 | } |
| 134 | } |
| 135 | |
| 136 | fn expand_hashrust-analyzer cargo ghost 0.1.5 derive/expand_hash().(input: &UnitStructrust-analyzer cargo ghost 0.1.5 parse/UnitStruct#) -> TokenStreamrust-analyzer cargo proc-macro2 1.0.107 TokenStream# { |
| 137 | let ident = &input.identrust-analyzer cargo ghost 0.1.5 parse/UnitStruct#ident.; |
| 138 | let (impl_generics, ty_generics, where_clause) = input.genericsrust-analyzer cargo ghost 0.1.5 parse/UnitStruct#generics..split_for_implrust-analyzer cargo syn 1.0.109 generics/impl#[Generics]split_for_impl().(); |
| 139 | |
| 140 | quoterust-analyzer cargo quote 1.0.47 quote!! { |
| 141 | impl #impl_generics ::core::hash::Hash |
| 142 | for #ident #ty_generics #where_clause { |
| 143 | #[inline] |
| 144 | fn hash<H: ::core::hash::Hasher>(&self, hasher: &mut H) { |
| 145 | let _ = hasher; |
| 146 | } |
| 147 | } |
| 148 | } |
| 149 | } |
| 150 | |
| 151 | fn expand_partialordrust-analyzer cargo ghost 0.1.5 derive/expand_partialord().(input: &UnitStructrust-analyzer cargo ghost 0.1.5 parse/UnitStruct#) -> TokenStreamrust-analyzer cargo proc-macro2 1.0.107 TokenStream# { |
| 152 | let ident = &input.identrust-analyzer cargo ghost 0.1.5 parse/UnitStruct#ident.; |
| 153 | let (impl_generics, ty_generics, where_clause) = input.genericsrust-analyzer cargo ghost 0.1.5 parse/UnitStruct#generics..split_for_implrust-analyzer cargo syn 1.0.109 generics/impl#[Generics]split_for_impl().(); |
| 154 | |
| 155 | quoterust-analyzer cargo quote 1.0.47 quote!! { |
| 156 | impl #impl_generics ::core::cmp::PartialOrd |
| 157 | for #ident #ty_generics #where_clause { |
| 158 | #[inline] |
| 159 | fn partial_cmp(&self, other: &Self) -> ::core::option::Option<::core::cmp::Ordering> { |
| 160 | let _ = other; |
| 161 | ::core::option::Option::Some(::core::cmp::Ordering::Equal) |
| 162 | } |
| 163 | } |
| 164 | } |
| 165 | } |
| 166 | |
| 167 | fn expand_ordrust-analyzer cargo ghost 0.1.5 derive/expand_ord().(input: &UnitStructrust-analyzer cargo ghost 0.1.5 parse/UnitStruct#) -> TokenStreamrust-analyzer cargo proc-macro2 1.0.107 TokenStream# { |
| 168 | let ident = &input.identrust-analyzer cargo ghost 0.1.5 parse/UnitStruct#ident.; |
| 169 | let (impl_generics, ty_generics, where_clause) = input.genericsrust-analyzer cargo ghost 0.1.5 parse/UnitStruct#generics..split_for_implrust-analyzer cargo syn 1.0.109 generics/impl#[Generics]split_for_impl().(); |
| 170 | |
| 171 | quoterust-analyzer cargo quote 1.0.47 quote!! { |
| 172 | impl #impl_generics ::core::cmp::Ord |
| 173 | for #ident #ty_generics #where_clause { |
| 174 | #[inline] |
| 175 | fn cmp(&self, other: &Self) -> ::core::cmp::Ordering { |
| 176 | let _ = other; |
| 177 | ::core::cmp::Ordering::Equal |
| 178 | } |
| 179 | } |
| 180 | } |
| 181 | } |
| 182 | |
| 183 | fn expand_partialeqrust-analyzer cargo ghost 0.1.5 derive/expand_partialeq().(input: &UnitStructrust-analyzer cargo ghost 0.1.5 parse/UnitStruct#) -> TokenStreamrust-analyzer cargo proc-macro2 1.0.107 TokenStream# { |
| 184 | let ident = &input.identrust-analyzer cargo ghost 0.1.5 parse/UnitStruct#ident.; |
| 185 | let (impl_generics, ty_generics, where_clause) = input.genericsrust-analyzer cargo ghost 0.1.5 parse/UnitStruct#generics..split_for_implrust-analyzer cargo syn 1.0.109 generics/impl#[Generics]split_for_impl().(); |
| 186 | |
| 187 | quoterust-analyzer cargo quote 1.0.47 quote!! { |
| 188 | impl #impl_generics ::core::cmp::PartialEq |
| 189 | for #ident #ty_generics #where_clause { |
| 190 | #[inline] |
| 191 | fn eq(&self, other: &Self) -> bool { |
| 192 | let _ = other; |
| 193 | true |
| 194 | } |
| 195 | } |
| 196 | } |
| 197 | } |
| 198 | |
| 199 | fn expand_eqrust-analyzer cargo ghost 0.1.5 derive/expand_eq().(input: &UnitStructrust-analyzer cargo ghost 0.1.5 parse/UnitStruct#) -> TokenStreamrust-analyzer cargo proc-macro2 1.0.107 TokenStream# { |
| 200 | let ident = &input.identrust-analyzer cargo ghost 0.1.5 parse/UnitStruct#ident.; |
| 201 | let (impl_generics, ty_generics, where_clause) = input.genericsrust-analyzer cargo ghost 0.1.5 parse/UnitStruct#generics..split_for_implrust-analyzer cargo syn 1.0.109 generics/impl#[Generics]split_for_impl().(); |
| 202 | |
| 203 | quoterust-analyzer cargo quote 1.0.47 quote!! { |
| 204 | impl #impl_generics ::core::cmp::Eq |
| 205 | for #ident #ty_generics #where_clause {} |
| 206 | } |
| 207 | } |
| 208 | |
| 209 | fn expand_debugrust-analyzer cargo ghost 0.1.5 derive/expand_debug().(input: &UnitStructrust-analyzer cargo ghost 0.1.5 parse/UnitStruct#) -> TokenStreamrust-analyzer cargo proc-macro2 1.0.107 TokenStream# { |
| 210 | let ident = &input.identrust-analyzer cargo ghost 0.1.5 parse/UnitStruct#ident.; |
| 211 | let (impl_generics, ty_generics, where_clause) = input.genericsrust-analyzer cargo ghost 0.1.5 parse/UnitStruct#generics..split_for_implrust-analyzer cargo syn 1.0.109 generics/impl#[Generics]split_for_impl().(); |
| 212 | let string = ident.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(); |
| 213 | |
| 214 | quoterust-analyzer cargo quote 1.0.47 quote!! { |
| 215 | impl #impl_generics ::core::fmt::Debug |
| 216 | for #ident #ty_generics #where_clause { |
| 217 | fn fmt(&self, formatter: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { |
| 218 | ::core::fmt::Formatter::write_str(formatter, #string) |
| 219 | } |
| 220 | } |
| 221 | } |
| 222 | } |