@@ -431,12 +431,12 @@ impl<'a> Renderer<'a> {
431
431
// We need to make a new context for the macro from the arguments given
432
432
// Return an error if we get some unknown params
433
433
let mut context = HashMap :: new ( ) ;
434
- for ( param_name, exp) in call_params. clone ( ) {
434
+ for ( param_name, exp) in & call_params {
435
435
if !params. contains ( & param_name) {
436
436
let params_seen = call_params. keys ( ) . cloned ( ) . collect :: < Vec < String > > ( ) ;
437
437
bail ! ( "Macro `{}` got `{:?}` for args but was expecting `{:?}` (order does not matter)" , macro_name, params, params_seen) ;
438
438
}
439
- context. insert ( param_name. to_string ( ) , self . eval_expression ( exp) ?) ;
439
+ context. insert ( param_name. to_string ( ) , self . eval_expression ( exp. clone ( ) ) ?) ;
440
440
}
441
441
442
442
// Push this context to our stack of macro context so the renderer can pick variables
@@ -555,10 +555,10 @@ impl<'a> Renderer<'a> {
555
555
556
556
match self . template . blocks_definitions . get ( & name) {
557
557
Some ( b) => {
558
- match b[ new_level] . clone ( ) {
559
- ( tpl_name, Block { body, .. } ) => {
560
- self . blocks . push ( ( name. clone ( ) , new_level) ) ;
561
- let has_macro = self . import_macros ( tpl_name) ?;
558
+ match & b[ new_level] {
559
+ & ( ref tpl_name, Block { ref body, .. } ) => {
560
+ self . blocks . push ( ( name, new_level) ) ;
561
+ let has_macro = self . import_macros ( tpl_name. clone ( ) ) ?;
562
562
let res = self . render_node ( * body. clone ( ) ) ;
563
563
if has_macro {
564
564
self . macros . pop ( ) ;
0 commit comments