use Vec::with_capacity(raw.len()) for Cookies

This commit is contained in:
Sean McArthur
2014-11-10 09:32:18 -08:00
parent 5c224289ec
commit 33210641f7
2 changed files with 2 additions and 3 deletions

View File

@@ -23,7 +23,7 @@ impl Header for Cookies {
}
fn parse_header(raw: &[Vec<u8>]) -> Option<Cookies> {
let mut cookies = vec![];
let mut cookies = Vec::with_capacity(raw.len());
for cookies_raw in raw.iter() {
match from_utf8(cookies_raw[]) {
Some(cookies_str) => {
@@ -44,7 +44,6 @@ impl Header for Cookies {
None
}
}
}
impl HeaderFormat for Cookies {

View File

@@ -19,7 +19,7 @@ impl Header for SetCookie {
}
fn parse_header(raw: &[Vec<u8>]) -> Option<SetCookie> {
let mut set_cookies = vec![];
let mut set_cookies = Vec::with_capacity(raw.len());
for set_cookies_raw in raw.iter() {
match from_utf8(set_cookies_raw[]) {
Some(s) if !s.is_empty() => {