Radish alpha
h
rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5
Radicle Heartwood Protocol & Stack
Radicle
Git
radicle/tor: Fixes
Merged lorenz opened 29 days ago

Fixes two earlier mistakes:

  1. In fb18083, fn null_to_default was added, which is only conditionally used if the feature “tor” is enabled, so also only conditionally compile the function.
  2. In 1e13268, the impl Arbitrary for AddressType` was not properly adjusted for the case where the newly introduced feature “tor” is disabled.
2 files changed +7 -1 f223afd9 b54fc820
modified crates/radicle/src/serde_ext.rs
@@ -47,6 +47,7 @@ where
}

/// Deserialize a value, but if it is `null`, return the default value.
+
#[cfg(feature = "tor")]
pub(crate) fn null_to_default<'de, D, T>(deserializer: D) -> Result<T, D::Error>
where
    T: serde::Deserialize<'de> + Default,
modified crates/radicle/src/test/arbitrary.rs
@@ -208,7 +208,12 @@ impl Arbitrary for MockRepository {

impl Arbitrary for AddressType {
    fn arbitrary(g: &mut qcheck::Gen) -> Self {
-
        let t = *g.choose(&[1, 2, 3, 4]).unwrap() as u8;
+
        #[cfg(not(feature = "tor"))]
+
        let types = [1, 2, 3];
+
        #[cfg(feature = "tor")]
+
        let types = [1, 2, 3, 4];
+

+
        let t = *g.choose(&types).unwrap() as u8;

        AddressType::try_from(t).unwrap()
    }