[librsvg/librsvg-2.46] xml: shorten code using a single match
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg/librsvg-2.46] xml: shorten code using a single match
- Date: Tue, 15 Oct 2019 16:46:08 +0000 (UTC)
commit 8c1959ff22b1526e02be6a587e5787880ea2b0ad
Author: Paolo Borelli <pborelli gnome org>
Date: Sun Oct 13 12:27:59 2019 +0200
xml: shorten code using a single match
rsvg_internals/src/xml.rs | 20 ++++++++------------
1 file changed, 8 insertions(+), 12 deletions(-)
---
diff --git a/rsvg_internals/src/xml.rs b/rsvg_internals/src/xml.rs
index d16b587d..cb196e4d 100644
--- a/rsvg_internals/src/xml.rs
+++ b/rsvg_internals/src/xml.rs
@@ -603,19 +603,15 @@ fn parse_xml_stylesheet_processing_instruction(data: &str) -> Result<Vec<(String
let reader = ParserConfig::new().create_reader(&mut buf);
for event in reader {
- if let Ok(event) = event {
- match event {
- XmlEvent::StartElement { attributes, .. } => {
- return Ok(attributes
- .iter()
- .map(|att| (att.name.local_name.clone(), att.value.clone()))
- .collect());
- }
-
- _ => (),
+ match event {
+ Ok(XmlEvent::StartElement { attributes, .. }) => {
+ return Ok(attributes
+ .iter()
+ .map(|att| (att.name.local_name.clone(), att.value.clone()))
+ .collect());
}
- } else {
- return Err(());
+ Err(_) => return Err(()),
+ _ => (),
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]