@@ -18,16 +18,16 @@ impl Bindings {
18
18
let mut b = self . inner . get ( name) . ok_or_else ( || {
19
19
ExpandError :: BindingError ( format ! ( "could not find binding `{}`" , name) )
20
20
} ) ?;
21
- for s in nesting. iter_mut ( ) {
22
- s . hit = true ;
21
+ for nesting_state in nesting. iter_mut ( ) {
22
+ nesting_state . hit = true ;
23
23
b = match b {
24
24
Binding :: Fragment ( _) => break ,
25
- Binding :: Nested ( bs) => bs. get ( s . idx ) . ok_or_else ( || {
26
- s . at_end = true ;
25
+ Binding :: Nested ( bs) => bs. get ( nesting_state . idx ) . ok_or_else ( || {
26
+ nesting_state . at_end = true ;
27
27
ExpandError :: BindingError ( format ! ( "could not find nested binding `{}`" , name) )
28
28
} ) ?,
29
29
Binding :: Empty => {
30
- s . at_end = true ;
30
+ nesting_state . at_end = true ;
31
31
return Err ( ExpandError :: BindingError ( format ! (
32
32
"could not find empty binding `{}`" ,
33
33
name
@@ -61,7 +61,11 @@ pub(super) fn transcribe(
61
61
#[ derive( Debug ) ]
62
62
struct NestingState {
63
63
idx : usize ,
64
+ /// `hit` is currently necessary to tell `expand_repeat` if it should stop
65
+ /// because there is no variable in use by the current repetition
64
66
hit : bool ,
67
+ /// `at_end` is currently necessary to tell `expand_repeat` if it should stop
68
+ /// because there is no more value avaible for the current repetition
65
69
at_end : bool ,
66
70
}
67
71
@@ -130,8 +134,7 @@ fn expand_var(ctx: &mut ExpandCtx, v: &SmolStr) -> Result<Fragment, ExpandError>
130
134
. into ( ) ;
131
135
Fragment :: Tokens ( tt)
132
136
} else {
133
- let fragment = ctx. bindings . get ( & v, & mut ctx. nesting ) ?. clone ( ) ;
134
- fragment
137
+ ctx. bindings . get ( & v, & mut ctx. nesting ) ?. clone ( )
135
138
} ;
136
139
Ok ( res)
137
140
}
0 commit comments