From 2fb540f85beadf3c74e7cadb10b7423483c8e37e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maxime=20=E2=80=9Cpep=E2=80=9D=20Buquet?= Date: Thu, 28 Dec 2017 16:20:32 +0100 Subject: [PATCH] component: Fix attributes parsing; thanks Link Mauve --- src/component.rs | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/src/component.rs b/src/component.rs index c8ea7e0..be59823 100644 --- a/src/component.rs +++ b/src/component.rs @@ -138,24 +138,22 @@ impl Component { let e = transport.read_event()?; match e { XmlEvent::Start(ref e) => { - let mut attributes = e.attributes() - .map(|o| { - let o = o?; - let key = str::from_utf8(o.key)?; - let value = str::from_utf8(&o.value)?; - Ok((key, value)) - } - ) - .collect::, Error>>()?; - for &(name, value) in &attributes { - if name == "id" { - sid = value.to_owned(); + for attr_result in e.attributes() { + match attr_result { + Ok(attr) => { + let name = str::from_utf8(attr.key)?; + let value = str::from_utf8(&attr.value)?; + if name == "id" { + sid = value.to_owned(); + } + }, + _ => panic!() } } + break; }, _ => (), } - break } let concatenated = format!("{}{}", sid, secret); let mut hasher = Sha1::default();