From: Greg Burri Date: Wed, 19 Mar 2025 00:06:57 +0000 (+0100) Subject: Update ron version to 0.9 X-Git-Url: https://git.euphorik.ch/?a=commitdiff_plain;h=b812525f4b1fe620e32bdf23be7b97162e5a0c59;p=recipes.git Update ron version to 0.9 --- diff --git a/Cargo.lock b/Cargo.lock index 08a250d..ccf8b95 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -253,12 +253,6 @@ dependencies = [ "windows-targets 0.52.6", ] -[[package]] -name = "base64" -version = "0.21.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" - [[package]] name = "base64" version = "0.22.1" @@ -616,7 +610,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "20b9cde6a71f9f758440470f3de16db6c09a02c443ce66850d87f5410548fb8e" dependencies = [ - "base64 0.22.1", + "base64", "memchr", ] @@ -1449,7 +1443,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "759bc2b8eabb6a30b235d6f716f7f36479f4b38cbe65b8747aefee51f89e8437" dependencies = [ "async-trait", - "base64 0.22.1", + "base64", "chumsky", "email-encoding", "email_address", @@ -2092,14 +2086,15 @@ dependencies = [ [[package]] name = "ron" -version = "0.8.1" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b91f7eff05f748767f183df4320a63d6936e9c6107d97c9e6bdd9784f4289c94" +checksum = "63f3aa105dea217ef30d89581b65a4d527a19afc95ef5750be3890e8d3c5b837" dependencies = [ - "base64 0.21.7", + "base64", "bitflags", "serde", "serde_derive", + "unicode-ident", ] [[package]] @@ -2480,7 +2475,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4560278f0e00ce64938540546f59f590d60beee33fffbd3b9cd47851e5fff233" dependencies = [ "atoi", - "base64 0.22.1", + "base64", "bitflags", "byteorder", "bytes", @@ -2523,7 +2518,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c5b98a57f363ed6764d5b3a12bfedf62f07aa16e1856a7ddc2a0bb190a959613" dependencies = [ "atoi", - "base64 0.22.1", + "base64", "bitflags", "byteorder", "chrono", @@ -2586,9 +2581,9 @@ checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" [[package]] name = "stacker" -version = "0.1.19" +version = "0.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9156ebd5870ef293bfb43f91c7a74528d363ec0d424afe24160ed5a4343d08a" +checksum = "601f9201feb9b09c00266478bf459952b9ef9a6b94edb2f21eba14ab681a60a9" dependencies = [ "cc", "cfg-if", diff --git a/backend/Cargo.toml b/backend/Cargo.toml index bc4736f..39eb1a6 100644 --- a/backend/Cargo.toml +++ b/backend/Cargo.toml @@ -19,7 +19,7 @@ tracing-subscriber = { version = "0.3", features = ["env-filter"] } chrono = { version = "0.4", features = ["serde"] } # Rust object notation, to load configuration files. -ron = "0.8" # Can't upgrade to 0.9 because of https://github.com/ron-rs/ron/issues/561. +ron = "0.9" serde = { version = "1.0", features = ["derive"] } itertools = "0.14" diff --git a/backend/src/config.rs b/backend/src/config.rs index 93e7ebb..665fb16 100644 --- a/backend/src/config.rs +++ b/backend/src/config.rs @@ -1,8 +1,11 @@ -use std::{fmt, fs::File}; +use std::{ + fmt, + fs::{self, File}, +}; use ron::{ de::from_reader, - ser::{PrettyConfig, to_writer_pretty}, + ser::{PrettyConfig, to_string_pretty}, }; use serde::{Deserialize, Serialize}; @@ -49,25 +52,14 @@ pub fn load() -> Config { ) }), Err(_) => { - let mut file = File::create(consts::FILE_CONF).unwrap_or_else(|error| { - panic!( - "Failed to create default configuration file {}: {}", - consts::FILE_CONF, - error - ) - }); - let default_config = Config::default(); - to_writer_pretty(&mut file, &default_config, PrettyConfig::new()).unwrap_or_else( - |error| { - panic!( - "Failed to write default configuration file {}: {}", - consts::FILE_CONF, - error - ) - }, - ); + let ron_string = to_string_pretty(&default_config, PrettyConfig::new()) + .unwrap_or_else(|error| panic!("Failed to serialize ron configuration: {}", error)); + + fs::write(consts::FILE_CONF, ron_string).unwrap_or_else(|error| { + panic!("Failed to write default configuration file: {}", error) + }); default_config } diff --git a/common/Cargo.toml b/common/Cargo.toml index f590015..dfb9699 100644 --- a/common/Cargo.toml +++ b/common/Cargo.toml @@ -5,6 +5,6 @@ authors = ["Grégory Burri "] edition = "2024" [dependencies] -ron = "0.8" # Can't upgrade to 0.9 because of https://github.com/ron-rs/ron/issues/561. +ron = "0.9" serde = { version = "1.0", features = ["derive"] } chrono = { version = "0.4", features = ["serde"] } diff --git a/frontend/Cargo.toml b/frontend/Cargo.toml index db04156..9636a9c 100644 --- a/frontend/Cargo.toml +++ b/frontend/Cargo.toml @@ -15,7 +15,7 @@ common = { path = "../common" } chrono = { version = "0.4", features = ["serde", "unstable-locales"] } -ron = "0.8" # Can't upgrade to 0.9 because of https://github.com/ron-rs/ron/issues/561. +ron = "0.9" serde = { version = "1.0", features = ["derive"] } serde_html_form = "0.2" thiserror = "2"