From 0621ab6652b5a1e9e577647d99cbbb875482e4d6 Mon Sep 17 00:00:00 2001 From: JT <547158+jntrnr@users.noreply.github.com> Date: Fri, 2 Dec 2022 08:25:13 +1300 Subject: [PATCH] couple minor updates to xml deps (#7311) # Description Just some minor updates to xml deps # User-Facing Changes _(List of all changes that impact the user experience here. This helps us keep track of breaking changes.)_ # Tests + Formatting Don't forget to add tests that cover your changes. Make sure you've run and fixed any issues with these commands: - `cargo fmt --all -- --check` to check standard code formatting (`cargo fmt --all` applies these changes) - `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used -A clippy::needless_collect` to check that you're using the standard code style - `cargo test --workspace` to check that all tests pass # After Submitting If your PR had any user-facing changes, update [the documentation](https://github.com/nushell/nushell.github.io) after the PR is merged, if necessary. This will help us keep the docs up to date. --- Cargo.lock | 35 +++++++++-------------- crates/nu-command/Cargo.toml | 6 ++-- crates/nu-command/src/formats/from/xml.rs | 3 +- crates/nu-command/src/formats/to/xml.rs | 6 ++-- 4 files changed, 21 insertions(+), 29 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 936ba17be4..0f53db7c24 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -439,15 +439,15 @@ checksum = "6c58ec36aac5066d5ca17df51b3e70279f5670a72102f5752cb7e7c856adfc70" [[package]] name = "calamine" -version = "0.18.0" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b86ca78da4bdce5ac0f0bdbc0218ad14232f1e668376e044233f64c527cf5abb" +checksum = "6381d1037ee9b8a6c8eb97936add0331a1aabd148d5b6f35f1cda6e5dec44f40" dependencies = [ "byteorder", "codepage", "encoding_rs", "log", - "quick-xml 0.19.0", + "quick-xml", "serde", "zip", ] @@ -2632,7 +2632,7 @@ dependencies = [ "polars", "powierza-coefficient", "proptest", - "quick-xml 0.23.1", + "quick-xml", "quickcheck", "quickcheck_macros", "rand 0.8.5", @@ -3795,23 +3795,14 @@ checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3" [[package]] name = "quick-xml" -version = "0.19.0" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3d72d5477478f85bd00b6521780dfba1ec6cdaadcf90b8b181c36d7de561f9b" +checksum = "58e21a144a0ffb5fad7b464babcdab934a325ad69b7c0373bcfef5cbd9799ca9" dependencies = [ "encoding_rs", "memchr", ] -[[package]] -name = "quick-xml" -version = "0.23.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11bafc859c6815fbaffbbbf4229ecb767ac913fecb27f9ad4343662e9ef099ea" -dependencies = [ - "memchr", -] - [[package]] name = "quickcheck" version = "1.0.3" @@ -4129,9 +4120,9 @@ dependencies = [ [[package]] name = "roxmltree" -version = "0.14.1" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "921904a62e410e37e215c40381b7117f830d9d89ba60ab5236170541dd25646b" +checksum = "fb6d47b59770b0ae88c7f270c68502832ec14d8c7ab5f7a584f204bb76dbfd8e" dependencies = [ "xmlparser", ] @@ -5736,9 +5727,9 @@ dependencies = [ [[package]] name = "xmlparser" -version = "0.13.3" +version = "0.13.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "114ba2b24d2167ef6d67d7d04c8cc86522b87f490025f39f0303b7db5bf5e3d8" +checksum = "4d25c75bf9ea12c4040a97f829154768bbbce366287e2dc044af160cd79a13fd" [[package]] name = "yansi" @@ -5748,14 +5739,14 @@ checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" [[package]] name = "zip" -version = "0.5.13" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93ab48844d61251bb3835145c521d88aa4031d7139e8485990f60ca911fa0815" +checksum = "537ce7411d25e54e8ae21a7ce0b15840e7bfcff15b51d697ec3266cc76bdf080" dependencies = [ "byteorder", "crc32fast", + "crossbeam-utils", "flate2", - "thiserror", ] [[package]] diff --git a/crates/nu-command/Cargo.toml b/crates/nu-command/Cargo.toml index fd95483aa4..7e2282ef64 100644 --- a/crates/nu-command/Cargo.toml +++ b/crates/nu-command/Cargo.toml @@ -32,7 +32,7 @@ alphanumeric-sort = "1.4.4" base64 = "0.13.0" byteorder = "1.4.3" bytesize = "1.1.0" -calamine = "0.18.0" +calamine = "0.19.1" chrono = { version = "0.4.23", features = ["unstable-locales", "std"], default-features = false } chrono-humanize = "0.2.1" chrono-tz = "0.6.3" @@ -65,11 +65,11 @@ num-traits = "0.2.14" once_cell = "1.0" pathdiff = "0.2.1" powierza-coefficient = "1.0.1" -quick-xml = "0.23.0" +quick-xml = "0.25" rand = "0.8" rayon = "1.5.1" reqwest = {version = "0.11", features = ["blocking", "json"] } -roxmltree = "0.14.0" +roxmltree = "0.16.0" rust-embed = "6.3.0" same-file = "1.0.6" serde = { version="1.0.123", features=["derive"] } diff --git a/crates/nu-command/src/formats/from/xml.rs b/crates/nu-command/src/formats/from/xml.rs index f973ae10d9..986da9bb8e 100644 --- a/crates/nu-command/src/formats/from/xml.rs +++ b/crates/nu-command/src/formats/from/xml.rs @@ -124,7 +124,8 @@ fn from_node_to_value(n: &roxmltree::Node, span: Span) -> Value { let mut collected = IndexMap::new(); - let attribute_value: Value = from_attributes_to_value(n.attributes(), span); + let attribute_value: Value = + from_attributes_to_value(&n.attributes().collect::>(), span); let mut row = IndexMap::new(); row.insert( diff --git a/crates/nu-command/src/formats/to/xml.rs b/crates/nu-command/src/formats/to/xml.rs index 13333e89dc..371d282cdc 100644 --- a/crates/nu-command/src/formats/to/xml.rs +++ b/crates/nu-command/src/formats/to/xml.rs @@ -117,7 +117,7 @@ pub fn write_xml_events( match current { Value::Record { cols, vals, span } => { for (k, v) in cols.iter().zip(vals.iter()) { - let mut e = BytesStart::owned(k.as_bytes(), k.len()); + let mut e = BytesStart::new(k); if !is_xml_row(v) { return Err(ShellError::GenericError( "Expected a row with 'children' and 'attributes' columns".to_string(), @@ -141,7 +141,7 @@ pub fn write_xml_events( } } writer - .write_event(Event::End(BytesEnd::borrowed(k.as_bytes()))) + .write_event(Event::End(BytesEnd::new(k))) .expect("Couldn't close XML node"); } } @@ -153,7 +153,7 @@ pub fn write_xml_events( _ => { let s = current.into_abbreviated_string(config); writer - .write_event(Event::Text(BytesText::from_plain_str(s.as_str()))) + .write_event(Event::Text(BytesText::from_escaped(s.as_str()))) .expect("Couldn't write XML text"); } }