changeset 50983:8343947af6a7

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.
author Raphaël Gomès <rgomes@octobus.net>
date Wed, 09 Aug 2023 15:46:35 +0200
parents 10e57e3f7276
children 727428c7e1fc
files rust/hg-core/src/config/config_items.rs rust/hg-core/src/config/mod.rs
diffstat 2 files changed, 2 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/rust/hg-core/src/config/config_items.rs	Wed Aug 09 15:44:56 2023 +0200
+++ b/rust/hg-core/src/config/config_items.rs	Wed Aug 09 15:46:35 2023 +0200
@@ -198,7 +198,7 @@
                     _ => Err(err),
                 }
             }
-            None => Ok(Some(false)),
+            None => Ok(None),
         }
     }
 }
--- a/rust/hg-core/src/config/mod.rs	Wed Aug 09 15:44:56 2023 +0200
+++ b/rust/hg-core/src/config/mod.rs	Wed Aug 09 15:46:35 2023 +0200
@@ -805,7 +805,6 @@
         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());
     }
 }