@@ -176,8 +176,8 @@ impl<'a, 'h> Generator<'a, 'h> {
176
176
buf. write ( '}' ) ;
177
177
178
178
#[ cfg( feature = "blocks" ) ]
179
- for ( block, span ) in self . input . blocks {
180
- self . impl_block ( buf, block, span ) ?;
179
+ for block in self . input . blocks {
180
+ self . impl_block ( buf, block) ?;
181
181
}
182
182
183
183
Ok ( size_hint)
@@ -187,8 +187,7 @@ impl<'a, 'h> Generator<'a, 'h> {
187
187
fn impl_block (
188
188
& self ,
189
189
buf : & mut Buffer ,
190
- block : & str ,
191
- span : & proc_macro2:: Span ,
190
+ block : & crate :: input:: Block ,
192
191
) -> Result < ( ) , CompileError > {
193
192
// RATIONALE: `*self` must be the input type, implementation details should not leak:
194
193
// - impl Self { fn as_block(self) } ->
@@ -199,7 +198,7 @@ impl<'a, 'h> Generator<'a, 'h> {
199
198
use quote:: quote_spanned;
200
199
use syn:: { GenericParam , Ident , Lifetime , LifetimeParam , Token } ;
201
200
202
- let span = * span;
201
+ let span = block . span ;
203
202
buf. write (
204
203
"\
205
204
#[allow(missing_docs, non_camel_case_types, non_snake_case, unreachable_pub)]\
@@ -208,11 +207,14 @@ impl<'a, 'h> Generator<'a, 'h> {
208
207
209
208
let ident = & self . input . ast . ident ;
210
209
211
- let doc = format ! ( "A sub-template that renders only the block `{block}` of [`{ident}`]." ) ;
212
- let method_name = format ! ( "as_{block}" ) ;
213
- let trait_name = format ! ( "__Rinja__{ident}__as__{block}" ) ;
214
- let wrapper_name = format ! ( "__Rinja__{ident}__as__{block}__Wrapper" ) ;
215
- let self_lt_name = format ! ( "'__Rinja__{ident}__as__{block}__self" ) ;
210
+ let doc = format ! (
211
+ "A sub-template that renders only the block `{}` of [`{ident}`]." ,
212
+ block. name
213
+ ) ;
214
+ let method_name = format ! ( "as_{}" , block. name) ;
215
+ let trait_name = format ! ( "__Rinja__{ident}__as__{}" , block. name) ;
216
+ let wrapper_name = format ! ( "__Rinja__{ident}__as__{}__Wrapper" , block. name) ;
217
+ let self_lt_name = format ! ( "'__Rinja__{ident}__as__{}__self" , block. name) ;
216
218
217
219
let method_id = Ident :: new ( & method_name, span) ;
218
220
let trait_id = Ident :: new ( & trait_name, span) ;
@@ -235,7 +237,7 @@ impl<'a, 'h> Generator<'a, 'h> {
235
237
wrapper_generics. split_for_impl ( ) ;
236
238
237
239
let input = TemplateInput {
238
- block : Some ( ( block, span) ) ,
240
+ block : Some ( ( & block. name , span) ) ,
239
241
#[ cfg( feature = "blocks" ) ]
240
242
blocks : & [ ] ,
241
243
..self . input . clone ( )
0 commit comments