From ab5f5c1c6066df8ca528811322947e045f96e925 Mon Sep 17 00:00:00 2001 From: Tpt Date: Thu, 2 Nov 2023 21:25:27 +0100 Subject: [PATCH] Upgrades quick-xml --- Cargo.lock | 4 ++-- lib/oxrdfxml/Cargo.toml | 2 +- lib/oxrdfxml/src/parser.rs | 2 +- lib/sparesults/Cargo.toml | 2 +- lib/sparesults/src/xml.rs | 16 +++++++--------- testsuite/src/lib.rs | 2 +- 6 files changed, 13 insertions(+), 15 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 605c7a9e..20bf72d6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1376,9 +1376,9 @@ dependencies = [ [[package]] name = "quick-xml" -version = "0.30.0" +version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eff6510e86862b57b210fd8cbe8ed3f0d7d600b9c2863cd4549a2e033c66e956" +checksum = "1004a344b30a54e2ee58d66a71b32d2db2feb0a31f9a2d302bf0536f15de2a33" dependencies = [ "memchr", "tokio", diff --git a/lib/oxrdfxml/Cargo.toml b/lib/oxrdfxml/Cargo.toml index 83739b35..660a631d 100644 --- a/lib/oxrdfxml/Cargo.toml +++ b/lib/oxrdfxml/Cargo.toml @@ -22,7 +22,7 @@ async-tokio = ["dep:tokio", "quick-xml/async-tokio"] oxrdf = { version = "0.2.0-alpha.1-dev", path = "../oxrdf" } oxilangtag = "0.1" oxiri = "0.2" -quick-xml = ">=0.29, <0.31" +quick-xml = ">=0.29, <0.32" tokio = { version = "1.29", optional = true, features = ["io-util"] } [dev-dependencies] diff --git a/lib/oxrdfxml/src/parser.rs b/lib/oxrdfxml/src/parser.rs index 086d094a..f13bbbd4 100644 --- a/lib/oxrdfxml/src/parser.rs +++ b/lib/oxrdfxml/src/parser.rs @@ -1144,7 +1144,7 @@ impl RdfXmlReader { fn convert_attribute(&self, attribute: &Attribute) -> Result { Ok(attribute .decode_and_unescape_value_with(&self.reader, |e| self.resolve_entity(e))? - .to_string()) + .into_owned()) } fn convert_iri_attribute( diff --git a/lib/sparesults/Cargo.toml b/lib/sparesults/Cargo.toml index 2516cdfa..e5ffe16f 100644 --- a/lib/sparesults/Cargo.toml +++ b/lib/sparesults/Cargo.toml @@ -22,7 +22,7 @@ rdf-star = ["oxrdf/rdf-star"] json-event-parser = "0.2.0-alpha.1" memchr = "2.5" oxrdf = { version = "0.2.0-alpha.1-dev", path="../oxrdf" } -quick-xml = ">=0.29, <0.31" +quick-xml = ">=0.29, <0.32" [package.metadata.docs.rs] all-features = true diff --git a/lib/sparesults/src/xml.rs b/lib/sparesults/src/xml.rs index 73d26fff..7df4fa9e 100644 --- a/lib/sparesults/src/xml.rs +++ b/lib/sparesults/src/xml.rs @@ -28,7 +28,7 @@ fn do_write_boolean_xml_result(sink: W, value: bool) -> Result XmlSolutionsWriter { .with_attribute(("name", variable.as_str())) .write_empty()?; } - Ok(()) + quick_xml::Result::Ok(()) })?; writer.write_event(Event::Start(BytesStart::new("results")))?; Ok(Self { writer }) @@ -81,12 +81,9 @@ impl XmlSolutionsWriter { writer .create_element("binding") .with_attribute(("name", variable.as_str())) - .write_inner_content(|writer| { - write_xml_term(value, writer)?; - Ok(()) - })?; + .write_inner_content(|writer| write_xml_term(value, writer))?; } - Ok(()) + quick_xml::Result::Ok(()) })?; Ok(()) } @@ -150,7 +147,7 @@ fn write_xml_term( .write_inner_content(|writer| { write_xml_term(triple.object.as_ref(), writer) })?; - Ok(()) + quick_xml::Result::Ok(()) })?; } } @@ -370,7 +367,8 @@ impl XmlSolutionsReader { } else if event.local_name().as_ref() == b"bnode" { state = State::BNode; } else if event.local_name().as_ref() == b"literal" { - for attr in event.attributes().flatten() { + for attr in event.attributes() { + let attr = attr.map_err(quick_xml::Error::from)?; if attr.key.as_ref() == b"xml:lang" { lang = Some( attr.decode_and_unescape_value(&self.reader)?.to_string(), diff --git a/testsuite/src/lib.rs b/testsuite/src/lib.rs index fc42e12e..e9ce6df0 100644 --- a/testsuite/src/lib.rs +++ b/testsuite/src/lib.rs @@ -27,7 +27,7 @@ pub fn check_testsuite(manifest_url: &str, ignored_tests: &[&str]) -> Result<()> for result in results { if let Err(error) = &result.outcome { if !ignored_tests.contains(&result.test.as_str()) { - errors.push(format!("{}: failed with error {}", result.test, error)) + errors.push(format!("{}: failed with error {error:?}", result.test)) } } }