From 4f8894f64578f8b62a65b33c81a60344ee851da5 Mon Sep 17 00:00:00 2001 From: Sergio Benitez Date: Wed, 8 Mar 2017 03:39:57 -0800 Subject: [PATCH] Don't allocate a String into after parsing a cookie. --- lib/src/http/session.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/src/http/session.rs b/lib/src/http/session.rs index b21dc2c4..efcb7920 100644 --- a/lib/src/http/session.rs +++ b/lib/src/http/session.rs @@ -34,8 +34,8 @@ impl<'a> Session<'a> { return None; } - let string = cookie_str[SESSION_PREFIX.len()..].to_string(); - Cookie::parse(string).ok() + Cookie::parse(&cookie_str[SESSION_PREFIX.len()..]).ok() + .map(|c| c.into_owned()) } pub fn get(&self, name: &str) -> Option> {