From 420fd891745c65f2607535a077cb93a9bbb32531 Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Thu, 10 Aug 2017 12:22:07 +0200 Subject: Prevent allocations for loop target names --- askama_derive/src/generator.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'askama_derive/src') diff --git a/askama_derive/src/generator.rs b/askama_derive/src/generator.rs index 713d9b6..7cdc7b4 100644 --- a/askama_derive/src/generator.rs +++ b/askama_derive/src/generator.rs @@ -284,11 +284,11 @@ impl<'a> Generator<'a> { } } - fn visit_target_single(&mut self, name: &str) -> Vec { - vec![name.to_string()] + fn visit_target_single<'t>(&mut self, name: &'t str) -> Vec<&'t str> { + vec![name] } - fn visit_target(&mut self, target: &Target) -> Vec { + fn visit_target<'t>(&mut self, target: &'t Target) -> Vec<&'t str> { match *target { Target::Name(s) => { self.visit_target_single(s) }, } -- cgit