Remove unnecessary lookup of type

This commit is contained in:
notplants 2021-12-28 20:37:36 -05:00
parent 1b2b1db95f
commit 69f080fe57
1 changed files with 2 additions and 4 deletions

View File

@ -67,10 +67,8 @@ impl SsbMessageValue {
///
/// * `value` - A serde value to be parsed into a TypedMessage.
pub fn get_typed_message_from_value(value: Value) -> Result<TypedMessage, GolgiError> {
let message_type = value.get("type").ok_or(GolgiError::ContentTypeDecode("no type field in content".to_string()))?;
let message_type_str = message_type.as_str().ok_or(GolgiError::ContentTypeDecode("invalid type field in content".to_string()))?;
let to_return: TypedMessage = serde_json::from_value(value)?;
Ok(to_return)
let typed_message: TypedMessage = serde_json::from_value(value)?;
Ok(typed_message)
}
/// Data type representing the `value` of a message object (`KVT`),