Skip to content

Commit

Permalink
deps: bump quick-xml dependency from 0.31 to 0.32
Browse files Browse the repository at this point in the history
  • Loading branch information
decathorpe committed Jul 15, 2024
1 parent e92e91e commit 9fd54df
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 19 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dxr/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ required-features = ["derive", "i8", "nil"]
dxr_derive = { workspace = true, optional = true }
base64 = "0.22"
chrono = { version = "0.4.19", features = ["std"], default-features = false }
quick-xml = { version = "0.31", features = ["serialize"] }
quick-xml = { version = "0.32", features = ["serialize"] }
serde = { version = "1.0.104", features = ["derive"] }
thiserror = "1.0.30"

Expand Down
7 changes: 1 addition & 6 deletions dxr/src/checks/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,13 @@ fn from_to_boolean(boolean: bool) -> bool {

#[quickcheck]
fn to_from_string(string: String) -> bool {
// This creates a new <string> type on a code path that does no XML escaping,
// so the string needs to be trimmed and XML-escaped first.
let string = quick_xml::escape::escape(string.trim()).to_string();
let value = Type::String(string);
let value = Type::String(string.trim().to_string());

value == from_str::<Type>(&to_string(&value).unwrap()).unwrap()
}

#[quickcheck]
fn from_to_string(string: String) -> bool {
// This creates a new <string> type on a code path that does no XML escaping,
// so the string needs to be trimmed and XML-escaped first.
let string = quick_xml::escape::escape(string.trim()).to_string();
let value = format!("<string>{string}</string>");

Expand Down
7 changes: 1 addition & 6 deletions dxr/src/checks/values.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,18 +53,13 @@ fn from_to_boolean(boolean: bool) -> bool {

#[quickcheck]
fn to_from_string(string: String) -> bool {
// This creates a new <string> value on a code path that does no XML escaping,
// so the string needs to be trimmed and XML-escaped first.
let string = quick_xml::escape::escape(string.trim()).to_string();
let value = Value::string(string);
let value = Value::string(string.trim().to_string());

value == from_str::<Value>(&to_string(&value).unwrap()).unwrap()
}

#[quickcheck]
fn from_to_string(string: String) -> bool {
// This creates a new <string> value on a code path that does no XML escaping,
// so the string needs to be trimmed and XML-escaped first.
let string = quick_xml::escape::escape(string.trim()).to_string();
let value = format!("<value><string>{string}</string></value>");

Expand Down
2 changes: 1 addition & 1 deletion dxr/src/tests/xml/arrays.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::xml::{deserialize_xml as from_str, serialize_xml as to_string};
#[test]
fn to_array_empty() {
let value = Array::new(vec![]);
let expected = "<array><data/></array>";
let expected = "<array><data></data></array>";

assert_eq!(to_string(&value).unwrap(), expected);
}
Expand Down
2 changes: 1 addition & 1 deletion dxr/src/tests/xml/structs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ fn from_member() {
#[test]
fn to_struct_empty() {
let value = Struct::new(vec![]);
let expected = "<struct/>";
let expected = "<struct></struct>";

assert_eq!(to_string(&value).unwrap(), expected);
}
Expand Down
5 changes: 4 additions & 1 deletion dxr/src/values/ser_de.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,12 @@ pub(crate) mod base64 {
/// `<value><string>foo</string></value>` (which are both valid XML-RPC).
pub(crate) mod value {
use serde::{
de::{self, Deserializer, IgnoredAny, Visitor},
de::{self, Deserializer, Visitor},
Deserialize,
};
#[cfg(feature = "nil")]
use serde::de::IgnoredAny;

use std::fmt;

use crate::values::Value;
Expand Down
3 changes: 2 additions & 1 deletion dxr/src/xml.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use quick_xml::de::DeError;
use quick_xml::se::Serializer;
use quick_xml::se::{QuoteLevel, Serializer};

use serde::{Deserialize, Serialize};

Expand All @@ -20,6 +20,7 @@ where
// initialize custom serializer that expands empty elements
let mut serializer = Serializer::new(&mut buf);
serializer.expand_empty_elements(true);
serializer.set_quote_level(QuoteLevel::Full);

value.serialize(serializer)?;
Ok(buf)
Expand Down

0 comments on commit 9fd54df

Please sign in to comment.