state-res: Return borrowed content in Event method

This commit is contained in:
Jonas Platte
2021-09-13 18:51:37 +02:00
parent e49f76b4be
commit 0999e420ae
5 changed files with 43 additions and 27 deletions

View File

@@ -573,10 +573,10 @@ mod event {
}
}
fn content(&self) -> serde_json::Value {
fn content(&self) -> &serde_json::Value {
match &self.rest {
Pdu::RoomV1Pdu(ev) => ev.content.clone(),
Pdu::RoomV3Pdu(ev) => ev.content.clone(),
Pdu::RoomV1Pdu(ev) => &ev.content,
Pdu::RoomV3Pdu(ev) => &ev.content,
#[cfg(not(feature = "unstable-exhaustive-types"))]
_ => unreachable!("new PDU version"),
}