From a993920ae634c9478a5d69480886586a338b3306 Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Tue, 8 Aug 2017 12:18:34 +0200 Subject: Move path_as_identifier() closer to driver --- askama_derive/src/generator.rs | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'askama_derive') diff --git a/askama_derive/src/generator.rs b/askama_derive/src/generator.rs index f2bb88a..a90fb40 100644 --- a/askama_derive/src/generator.rs +++ b/askama_derive/src/generator.rs @@ -6,18 +6,6 @@ use std::collections::HashSet; use syn; use quote::{Tokens, ToTokens}; -fn path_as_identifier(s: &str) -> String { - let mut res = String::new(); - for c in s.chars() { - if c.is_alphanumeric() { - res.push(c); - } else { - res.push_str(&format!("{:x}", c as u32)); - } - } - res -} - struct Generator<'a> { buf: String, indent: u8, @@ -451,6 +439,18 @@ impl<'a> Generator<'a> { } +fn path_as_identifier(s: &str) -> String { + let mut res = String::new(); + for c in s.chars() { + if c.is_alphanumeric() { + res.push(c); + } else { + res.push_str(&format!("{:x}", c as u32)); + } + } + res +} + pub fn generate(ast: &syn::DeriveInput, path: &str, mut nodes: Vec) -> String { let mut base: Option = None; let mut blocks = Vec::new(); -- cgit