diff options
author | Dirkjan Ochtman <dirkjan@ochtman.nl> | 2017-08-10 12:22:07 +0200 |
---|---|---|
committer | Dirkjan Ochtman <dirkjan@ochtman.nl> | 2017-08-10 12:22:07 +0200 |
commit | 420fd891745c65f2607535a077cb93a9bbb32531 (patch) | |
tree | 0386d948c81c49f4accac9221f128bc793472fab /askama_derive | |
parent | cece25b0be1f09f6ab9d53d099bb244858928f57 (diff) | |
download | askama-420fd891745c65f2607535a077cb93a9bbb32531.tar.gz askama-420fd891745c65f2607535a077cb93a9bbb32531.tar.bz2 askama-420fd891745c65f2607535a077cb93a9bbb32531.zip |
Prevent allocations for loop target names
Diffstat (limited to 'askama_derive')
-rw-r--r-- | askama_derive/src/generator.rs | 6 |
1 files changed, 3 insertions, 3 deletions
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<String> { - 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<String> { + fn visit_target<'t>(&mut self, target: &'t Target) -> Vec<&'t str> { match *target { Target::Name(s) => { self.visit_target_single(s) }, } |