@@ -30,38 +30,10 @@ impl Template {
3030 let source = & self . source ;
3131 let src = source. src ( ) ;
3232
33- let Implementation { body, text, tokens } = Implementation :: parse ( & src, self . escape , false ) ;
33+ let Implementation { body, text } = Implementation :: parse ( & src, self . escape , false ) ;
3434
3535 let ( impl_generics, ty_generics, where_clause) = self . generics . split_for_impl ( ) ;
3636
37- let tokens = if cfg ! ( feature = "reload" ) {
38- let tokens = tokens
39- . into_iter ( )
40- . map ( |token| match token {
41- Token :: Code { contents } => quote ! ( :: boilerplate:: Token :: Code { contents: #contents } ) ,
42- Token :: CodeLine { closed, contents } => {
43- quote ! ( :: boilerplate:: Token :: CodeLine { closed: #closed, contents: #contents } )
44- }
45- Token :: Interpolation { contents } => {
46- quote ! ( :: boilerplate:: Token :: Interpolation { contents: #contents } )
47- }
48- Token :: InterpolationLine { contents, closed } => {
49- quote ! ( :: boilerplate:: Token :: InterpolationLine { closed: #closed, contents: #contents } )
50- }
51- Token :: Text { contents, index } => quote ! ( :: boilerplate:: Token :: Text {
52- contents: #contents,
53- index: #index
54- } ) ,
55- } )
56- . collect :: < Vec < TokenStream > > ( ) ;
57-
58- Some ( quote ! {
59- const TOKENS : & ' static [ :: boilerplate:: Token <' static >] = & [ #( #tokens) , * ] ;
60- } )
61- } else {
62- None
63- } ;
64-
6537 let path = if cfg ! ( feature = "reload" ) {
6638 if let Source :: Path ( path) = & self . source {
6739 Some ( quote ! ( const PATH : Option <& ' static str > = Some ( #path) ; ) )
@@ -76,9 +48,9 @@ impl Template {
7648
7749 quote ! {
7850 impl #impl_generics :: boilerplate:: Boilerplate for #ident #ty_generics #where_clause {
79- const TEXT : & ' static [ & ' static str ] = & [ # ( #text ) , * ] ;
51+ const TEMPLATE : & ' static str = #source ;
8052
81- #tokens
53+ const TEXT : & ' static [ & ' static str ] = & [ # ( #text ) , * ] ;
8254
8355 #path
8456
@@ -132,16 +104,6 @@ mod tests {
132104
133105 #[ test]
134106 fn display_impl ( ) {
135- let tokens = if cfg ! ( feature = "reload" ) {
136- Some ( quote ! {
137- const TOKENS : & ' static [ :: boilerplate:: Token <' static >] = & [
138- :: boilerplate:: Token :: Text { contents: "" , index: 0usize }
139- ] ;
140- } )
141- } else {
142- None
143- } ;
144-
145107 let path = if cfg ! ( feature = "reload" ) {
146108 Some ( quote ! (
147109 const PATH : Option <& ' static str > = None ;
@@ -175,9 +137,9 @@ mod tests {
175137 . to_string( ) ,
176138 quote!(
177139 impl :: boilerplate:: Boilerplate for Foo {
178- const TEXT : & ' static [ & ' static str ] = & [ #text ] ;
140+ const TEMPLATE : & ' static str = "" ;
179141
180- #tokens
142+ const TEXT : & ' static [ & ' static str ] = & [ #text ] ;
181143
182144 #path
183145
0 commit comments