remove unnecessary tracing of pdu conversions
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
@@ -8,10 +8,10 @@ use ruma::{
|
||||
};
|
||||
use serde_json::{json, value::Value as JsonValue};
|
||||
|
||||
use crate::{implement, warn};
|
||||
use crate::implement;
|
||||
|
||||
#[must_use]
|
||||
#[implement(super::Pdu)]
|
||||
#[tracing::instrument(skip(self), level = "debug")]
|
||||
pub fn to_sync_room_event(&self) -> Raw<AnySyncTimelineEvent> {
|
||||
let (redacts, content) = self.copy_redacts();
|
||||
let mut json = json!({
|
||||
@@ -36,8 +36,8 @@ pub fn to_sync_room_event(&self) -> Raw<AnySyncTimelineEvent> {
|
||||
}
|
||||
|
||||
/// This only works for events that are also AnyRoomEvents.
|
||||
#[must_use]
|
||||
#[implement(super::Pdu)]
|
||||
#[tracing::instrument(skip(self), level = "debug")]
|
||||
pub fn to_any_event(&self) -> Raw<AnyEphemeralRoomEvent> {
|
||||
let (redacts, content) = self.copy_redacts();
|
||||
let mut json = json!({
|
||||
@@ -62,8 +62,8 @@ pub fn to_any_event(&self) -> Raw<AnyEphemeralRoomEvent> {
|
||||
serde_json::from_value(json).expect("Raw::from_value always works")
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
#[implement(super::Pdu)]
|
||||
#[tracing::instrument(skip(self), level = "debug")]
|
||||
pub fn to_room_event(&self) -> Raw<AnyTimelineEvent> {
|
||||
let (redacts, content) = self.copy_redacts();
|
||||
let mut json = json!({
|
||||
@@ -88,8 +88,8 @@ pub fn to_room_event(&self) -> Raw<AnyTimelineEvent> {
|
||||
serde_json::from_value(json).expect("Raw::from_value always works")
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
#[implement(super::Pdu)]
|
||||
#[tracing::instrument(skip(self), level = "debug")]
|
||||
pub fn to_message_like_event(&self) -> Raw<AnyMessageLikeEvent> {
|
||||
let (redacts, content) = self.copy_redacts();
|
||||
let mut json = json!({
|
||||
@@ -114,8 +114,8 @@ pub fn to_message_like_event(&self) -> Raw<AnyMessageLikeEvent> {
|
||||
serde_json::from_value(json).expect("Raw::from_value always works")
|
||||
}
|
||||
|
||||
#[implement(super::Pdu)]
|
||||
#[must_use]
|
||||
#[implement(super::Pdu)]
|
||||
pub fn to_state_event_value(&self) -> JsonValue {
|
||||
let mut json = json!({
|
||||
"content": self.content,
|
||||
@@ -134,14 +134,14 @@ pub fn to_state_event_value(&self) -> JsonValue {
|
||||
json
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
#[implement(super::Pdu)]
|
||||
#[tracing::instrument(skip(self), level = "debug")]
|
||||
pub fn to_state_event(&self) -> Raw<AnyStateEvent> {
|
||||
serde_json::from_value(self.to_state_event_value()).expect("Raw::from_value always works")
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
#[implement(super::Pdu)]
|
||||
#[tracing::instrument(skip(self), level = "debug")]
|
||||
pub fn to_sync_state_event(&self) -> Raw<AnySyncStateEvent> {
|
||||
let mut json = json!({
|
||||
"content": self.content,
|
||||
@@ -159,8 +159,8 @@ pub fn to_sync_state_event(&self) -> Raw<AnySyncStateEvent> {
|
||||
serde_json::from_value(json).expect("Raw::from_value always works")
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
#[implement(super::Pdu)]
|
||||
#[tracing::instrument(skip(self), level = "debug")]
|
||||
pub fn to_stripped_state_event(&self) -> Raw<AnyStrippedStateEvent> {
|
||||
let json = json!({
|
||||
"content": self.content,
|
||||
@@ -172,8 +172,8 @@ pub fn to_stripped_state_event(&self) -> Raw<AnyStrippedStateEvent> {
|
||||
serde_json::from_value(json).expect("Raw::from_value always works")
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
#[implement(super::Pdu)]
|
||||
#[tracing::instrument(skip(self), level = "debug")]
|
||||
pub fn to_stripped_spacechild_state_event(&self) -> Raw<HierarchySpaceChildEvent> {
|
||||
let json = json!({
|
||||
"content": self.content,
|
||||
@@ -186,8 +186,8 @@ pub fn to_stripped_spacechild_state_event(&self) -> Raw<HierarchySpaceChildEvent
|
||||
serde_json::from_value(json).expect("Raw::from_value always works")
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
#[implement(super::Pdu)]
|
||||
#[tracing::instrument(skip(self), level = "debug")]
|
||||
pub fn to_member_event(&self) -> Raw<StateEvent<RoomMemberEventContent>> {
|
||||
let mut json = json!({
|
||||
"content": self.content,
|
||||
|
||||
Reference in New Issue
Block a user