File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -114,6 +114,14 @@ impl Transformation {
114114 quote ! { :: benzina:: __private:: IndexMap :: <_, ( #( #values) , * ) > }
115115 }
116116
117+ fn tuple_from_vec ( vec : Vec < impl ToTokens > ) -> TokenStream {
118+ if vec. is_empty ( ) {
119+ quote ! { ( ) }
120+ } else {
121+ quote ! { ( #( #vec) , * , ) }
122+ }
123+ }
124+
117125 fn accumulator ( & self , accumulator_index : Option < usize > ) -> TokenStream {
118126 let accumulator_index = if let Some ( accumulator_index) = accumulator_index {
119127 let accumulator_index = Index :: from ( accumulator_index) ;
@@ -140,7 +148,8 @@ impl Transformation {
140148 quote ! { }
141149 } ;
142150
143- let or_insert = self . or_insert ( & tuple_index_overwrites) ;
151+ let or_insert_tokens =
152+ Transformation :: tuple_from_vec ( self . or_insert ( & tuple_index_overwrites) ) ;
144153 let accumulator = self
145154 . entries
146155 . iter ( )
@@ -157,7 +166,7 @@ impl Transformation {
157166 #wrapper {
158167 let mut accumulator = :: benzina:: __private:: indexmap:: map:: Entry :: or_insert(
159168 :: benzina:: __private:: IndexMap :: entry( & mut #accumulator_index, #id) ,
160- ( # ( #or_insert ) , * )
169+ #or_insert_tokens
161170 ) ;
162171 #( #accumulator) *
163172 }
You can’t perform that action at this time.
0 commit comments