From 1f14cb0393a525e01b184cb44ae65ef0881de76f Mon Sep 17 00:00:00 2001 From: Jonas Platte Date: Wed, 25 Nov 2020 18:40:16 +0100 Subject: [PATCH] events: Simplify html constructors for text & notice message event contents --- ruma-events/src/room/message.rs | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/ruma-events/src/room/message.rs b/ruma-events/src/room/message.rs index 9d120bb8..a505eefb 100644 --- a/ruma-events/src/room/message.rs +++ b/ruma-events/src/room/message.rs @@ -322,11 +322,7 @@ impl NoticeMessageEventContent { /// A convenience constructor to create an html notice. pub fn html(body: impl Into, html_body: impl Into) -> Self { - Self { - body: body.into(), - formatted: Some(FormattedBody::html(html_body)), - relates_to: None, - } + Self { formatted: Some(FormattedBody::html(html_body)), ..Self::plain(body) } } } @@ -443,11 +439,7 @@ impl TextMessageEventContent { /// A convenience constructor to create an html message. pub fn html(body: impl Into, html_body: impl Into) -> Self { - Self { - body: body.into(), - formatted: Some(FormattedBody::html(html_body)), - relates_to: None, - } + Self { formatted: Some(FormattedBody::html(html_body)), ..Self::plain(body) } } /// A convenience constructor to create a plain text message.