From 94db5b1cb6a99f46b05f4397e33a18e30409eba8 Mon Sep 17 00:00:00 2001 From: Juan Aguilar Santillana Date: Sat, 1 Dec 2018 00:52:41 +0100 Subject: Fix unnecessary len at capitalize filter --- askama_shared/src/filters/mod.rs | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/askama_shared/src/filters/mod.rs b/askama_shared/src/filters/mod.rs index 672c5b3..a001357 100644 --- a/askama_shared/src/filters/mod.rs +++ b/askama_shared/src/filters/mod.rs @@ -224,15 +224,12 @@ pub fn capitalize(s: &fmt::Display) -> Result { &*s }) { None => Ok(s), - _ => { - let l = s.len(); - match s.get_mut(1..l).map(|s| { - s.make_ascii_lowercase(); - &*s - }) { - _ => Ok(s), - } - } + _ => match s.get_mut(1..).map(|s| { + s.make_ascii_lowercase(); + &*s + }) { + _ => Ok(s), + }, } } -- cgit