Remove indexing in Aheader::from_str

This commit is contained in:
Alexander Krotov
2020-03-28 02:23:54 +03:00
committed by Alexander Krotov
parent 32bd6109e3
commit 24aa3c781b

View File

@@ -127,14 +127,10 @@ impl str::FromStr for Aheader {
.split(';')
.filter_map(|a| {
let attribute: Vec<&str> = a.trim().splitn(2, '=').collect();
if attribute.len() < 2 {
return None;
match &attribute[..] {
[key, value] => Some((key.trim().to_string(), value.trim().to_string())),
_ => None,
}
Some((
attribute[0].trim().to_string(),
attribute[1].trim().to_string(),
))
})
.collect();