Repository: sharkdp/bat (language: rust)

Issue:
Update for serde-yaml 0.9
Hi.

In debian we are currently working on updating the serde-yaml crate, while we do have a mechanism for packaging multiple versions of a crate it is something we try to avoid where possible. So I have been testing reverse-dependencies of serde-yaml with the dependency bumped.

After bumping the dependency, bat itself built fine and it's tests passed. However one of the examples needed a small patch to avoid using a removed function.

https://salsa.debian.org/rust-team/debcargo-conf/-/blob/3a24d2e9344d0a204bab9af9bc9cadfb375f81fc/src/bat/debian/patches/serde-yaml-0.9.diff


Discussion / hints:
`master` now uses serde 1.0, so I guess this can be closed.
serde-yaml != serde, the latter has been at 1.x for ages, the former has still not reached 1.0
Sorry, I've realised I made a typo, it's serde_yaml not serde-yaml.
Please assign this issue to me.

Fix patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d921f9bb09..b676caa1a0 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,7 +9,7 @@
 
 - Fix `more` not being found on Windows when provided via `BAT_PAGER`, see #2570, #2580, and #2651 (@mataha)
 - Switched default behavior of `--map-syntax` to be case insensitive #2520
-
+- Updated version of `serde_yaml` to `0.9`. See #2627 (@Raghav-Bell)
 ## Other
 
 - Output directory for generated assets (completion, manual) can be customized, see #2515 (@tranzystorek-io)
diff --git a/Cargo.lock b/Cargo.lock
index cfc26f1d48..037969d066 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -329,7 +329,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "907076dfda823b0b36d2a1bb5f90c96660a5bbcd7729e10727f07858f22c4edc"
 dependencies = [
  "cfg-if",
- "hashbrown",
+ "hashbrown 0.12.3",
  "lock_api",
  "once_cell",
  "parking_lot_core",
@@ -380,6 +380,12 @@ dependencies = [
  "cfg-if",
 ]
 
+[[package]]
+name = "equivalent"
+version = "1.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
+
 [[package]]
 name = "errno"
 version = "0.3.3"
@@ -569,6 +575,12 @@ version = "0.12.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
 
+[[package]]
+name = "hashbrown"
+version = "0.14.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7dfda62a12f55daeae5015f81b0baea145391cb4520f86c248fc615d72640d12"
+
 [[package]]
 name = "home"
 version = "0.5.5"
@@ -595,7 +607,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e"
 dependencies = [
  "autocfg",
- "hashbrown",
+ "hashbrown 0.12.3",
+]
+
+[[package]]
+name = "indexmap"
+version = "2.0.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8adf3ddd720272c6ea8bf59463c04e0f93d0bbf7c5439b691bca2987e0270897"
+dependencies = [
+ "equivalent",
+ "hashbrown 0.14.1",
 ]
 
 [[package]]
@@ -862,7 +884,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "9bd9647b268a3d3e14ff09c23201133a62589c658db02bb7388c7246aafe0590"
 dependencies = [
  "base64",
- "indexmap",
+ "indexmap 1.9.1",
  "line-wrap",
  "quick-xml",
  "serde",
@@ -1127,14 +1149,15 @@ dependencies = [
 
 [[package]]
 name = "serde_yaml"
-version = "0.8.26"
+version = "0.9.25"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "578a7433b776b56a35785ed5ce9a7e777ac0598aac5a6dd1b4b18a307c7fc71b"
+checksum = "1a49e178e4452f45cb61d0cd8cebc1b0fafd3e41929e996cef79aa3aca91f574"
 dependencies = [
- "indexmap",
+ "indexmap 2.0.2",
+ "itoa",
  "ryu",
  "serde",
- "yaml-rust",
+ "unsafe-libyaml",
 ]
 
 [[package]]
@@ -1363,6 +1386,12 @@ version = "0.1.10"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b"
 
+[[package]]
+name = "unsafe-libyaml"
+version = "0.2.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f28467d3e1d3c6586d8f25fa243f544f5800fec42d97032474e17222c2b75cfa"
+
 [[package]]
 name = "url"
 version = "2.3.1"
diff --git a/Cargo.toml b/Cargo.toml
index 7af3e6e16d..5f41b71eaf 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -54,7 +54,7 @@ shell-words = { version = "1.1.0", optional = true }
 unicode-width = "0.1.10"
 globset = "0.4"
 serde = { version = "1.0", features = ["derive"] }
-serde_yaml = "0.8"
+serde_yaml = "0.9"
 semver = "1.0"
 path_abs = { version = "0.5", default-features = false }
 clircle = "0.4"
diff --git a/examples/yaml.rs b/examples/yaml.rs
index 78df246422..fe95dac05f 100644
--- a/examples/yaml.rs
+++ b/examples/yaml.rs
@@ -23,7 +23,8 @@ fn main() {
         }],
     };
 
-    let bytes = serde_yaml::to_vec(&person).unwrap();
+    let mut bytes = Vec::with_capacity(128);
+    serde_yaml::to_writer(&mut bytes, &person).unwrap();
     PrettyPrinter::new()
         .language("yaml")
         .line_numbers(true)


Test patch: