From 2a6ec44ecc37298ebde3d0faaabd44460c943760 Mon Sep 17 00:00:00 2001 From: Brennan Kinney <5098581+polarathene@users.noreply.github.com> Date: Fri, 6 Oct 2023 10:21:38 +1300 Subject: [PATCH] chore: Review feedback - `ura` => `gura` corrections - `src/lib.rs` add mention for Gura support tests(fix): Use `FileFormat::Gura` chore: Version bump `gura` Signed-off-by: Brennan Kinney <5098581+polarathene@users.noreply.github.com> --- Cargo.toml | 4 ++-- src/file/format/mod.rs | 11 ++++++----- src/lib.rs | 2 +- tests/file_gura.rs | 4 ++-- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 51f60d4e..cac3baf7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" maintenance = { status = "actively-developed" } [features] -default = ["toml", "json", "yaml", "ini", "ron", "json5", "ura", "convert-case", "async"] +default = ["toml", "json", "yaml", "ini", "ron", "json5", "gura", "convert-case", "async"] json = ["serde_json"] yaml = ["yaml-rust"] ini = ["rust-ini"] @@ -37,7 +37,7 @@ yaml-rust = { version = "0.4", optional = true } rust-ini = { version = "0.19", optional = true } ron = { version = "0.8", optional = true } json5_rs = { version = "0.4", optional = true, package = "json5" } -gura = { version = "0.3.0", optional = true, package = "gura" } +gura = { version = "0.5", optional = true, package = "gura" } indexmap = { version = "2.0.0", features = ["serde"], optional = true } convert_case = { version = "0.6", optional = true } pathdiff = "0.2" diff --git a/src/file/format/mod.rs b/src/file/format/mod.rs index 5984ecd6..64e0db24 100644 --- a/src/file/format/mod.rs +++ b/src/file/format/mod.rs @@ -27,7 +27,7 @@ mod ron; #[cfg(feature = "json5")] mod json5; -#[cfg(feature = "ura")] +#[cfg(feature = "gura")] mod gura; /// File formats provided by the library. @@ -59,8 +59,8 @@ pub enum FileFormat { #[cfg(feature = "json5")] Json5, - /// GURA (parsed with ura) - #[cfg(feature = "ura")] + /// GURA (parsed with gura) + #[cfg(feature = "gura")] Gura, } @@ -88,7 +88,7 @@ lazy_static! { #[cfg(feature = "json5")] formats.insert(FileFormat::Json5, vec!["json5"]); - #[cfg(feature = "ura")] + #[cfg(feature = "gura")] formats.insert(FileFormat::Gura, vec!["ura"]); formats @@ -127,7 +127,7 @@ impl FileFormat { #[cfg(feature = "json5")] FileFormat::Json5 => json5::parse(uri, text), - #[cfg(feature = "ura")] + #[cfg(feature = "gura")] FileFormat::Gura => gura::parse(uri, text), #[cfg(all( @@ -137,6 +137,7 @@ impl FileFormat { not(feature = "ini"), not(feature = "ron"), not(feature = "json5"), + not(feature = "gura"), ))] _ => unreachable!("No features are enabled, this library won't work without features"), } diff --git a/src/lib.rs b/src/lib.rs index 511c638a..14fa4d5e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -6,7 +6,7 @@ //! - Environment variables //! - String literals in well-known formats //! - Another Config instance -//! - Files: TOML, JSON, YAML, INI, RON, JSON5 and custom ones defined with Format trait +//! - Files: TOML, JSON, YAML, INI, RON, JSON5, GURA and custom ones defined with Format trait //! - Manual, programmatic override (via a `.set` method on the Config instance) //! //! Additionally, Config supports: diff --git a/tests/file_gura.rs b/tests/file_gura.rs index 2bd0cca0..d55e663a 100644 --- a/tests/file_gura.rs +++ b/tests/file_gura.rs @@ -1,4 +1,4 @@ -#![cfg(feature = "json")] +#![cfg(feature = "gura")] use serde_derive::Deserialize; @@ -185,7 +185,7 @@ fn test_override_lowercase_value_for_enums() { std::env::set_var("test_bar", "I have been overridden_with_lower_case"); let cfg = Config::builder() - .add_source(File::new("tests/Settings-enum-test", FileFormat::Json)) + .add_source(File::new("tests/Settings-enum-test", FileFormat::Gura)) .add_source(config::Environment::with_prefix("test").separator("_")) .build() .unwrap();