diff --git a/rust-lib/flowy-ot/src/core/attributes/attributes_serde.rs b/rust-lib/flowy-ot/src/core/attributes/attributes_serde.rs index 659a384daf..f277de6dfe 100644 --- a/rust-lib/flowy-ot/src/core/attributes/attributes_serde.rs +++ b/rust-lib/flowy-ot/src/core/attributes/attributes_serde.rs @@ -71,7 +71,6 @@ impl<'de> Deserialize<'de> for Attributes { { let mut attributes = Attributes::new(); while let Some(key) = map.next_key::()? { - log::warn!("{:?}", key); let value = map.next_value::()?; attributes.add_kv(key, value); } @@ -103,10 +102,7 @@ impl<'de> Deserialize<'de> for AttributeValue { struct AttributeValueVisitor; impl<'de> Visitor<'de> for AttributeValueVisitor { type Value = AttributeValue; - fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - // - formatter.write_str("bool, usize or string") - } + fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { formatter.write_str("bool, usize or string") } fn visit_bool(self, value: bool) -> Result where E: de::Error, @@ -190,6 +186,16 @@ impl<'de> Deserialize<'de> for AttributeValue { { Ok(AttributeValue(None)) } + + fn visit_map(self, map: A) -> Result + where + A: MapAccess<'de>, + { + // https://github.com/serde-rs/json/issues/505 + let mut map = map; + let value = map.next_value::()?; + Ok(value) + } } deserializer.deserialize_any(AttributeValueVisitor)