# HG changeset patch # User Raphaël Gomès # Date 2023-08-09 13:46:35 # Node ID 8343947af6a7c2611562220499bd9fcff1d93faa # Parent 10e57e3f727617c1333865779a6ac8386f6b39ff rust-config: fix incorrect coercion of null values to false As explained in the previous changeset: Probably being too trigger happy about boolean values, I incorrectly set the transform for a `None` to a `Some(false)`. It would cause for example the `ui.formatted` value to be set to `Some(false)`, which turns off the colors among other things, when `None` would trigger the automatic behavior. diff --git a/rust/hg-core/src/config/config_items.rs b/rust/hg-core/src/config/config_items.rs --- a/rust/hg-core/src/config/config_items.rs +++ b/rust/hg-core/src/config/config_items.rs @@ -198,7 +198,7 @@ impl TryFrom<&DefaultConfigItem> for Opt _ => Err(err), } } - None => Ok(Some(false)), + None => Ok(None), } } } diff --git a/rust/hg-core/src/config/mod.rs b/rust/hg-core/src/config/mod.rs --- a/rust/hg-core/src/config/mod.rs +++ b/rust/hg-core/src/config/mod.rs @@ -805,7 +805,6 @@ mod tests { assert!(ret.is_ok(), "{:?}", ret); let ret = config.get_byte_size(b"ui", b"formatted"); - // FIXME should be `is_none()` - assert!(ret.unwrap().is_some()); + assert!(ret.unwrap().is_none()); } }