daydream

A small matrix web client written in rust
git clone git://archive.git.mtrnord.blog/daydream-mx/daydream.git
Log | Files | Refs | README | LICENSE

commit 0a9e8a09ce25b5672b20f18e068d66136d756d28
parent ef69e107b4ce5598fe0ac07537d986067c27555a
Author: Jonas Platte <jplatte+git@posteo.de>
Date:   Fri,  3 Jul 2020 20:22:49 +0200

Reduce cloning in RoomItem::view

Diffstat:
Msrc/app/components/room_list/item.rs | 14+++-----------
1 file changed, 3 insertions(+), 11 deletions(-)

diff --git a/src/app/components/room_list/item.rs b/src/app/components/room_list/item.rs @@ -46,25 +46,17 @@ impl Component for RoomItem { let room = self.props.room.clone().unwrap(); // TODO placeholder for encrypted rooms - let last_message = match self - .props - .room - .as_ref() - .unwrap() - .messages - .clone() - .into_iter() - .last() - { + let last_message = match self.props.room.as_ref().unwrap().messages.iter().last() { None => "".to_string(), Some(m) => { if let MessageEventContent::Text(text_event) = &m.content { - text_event.clone().body + text_event.body.clone() } else { "".to_string() } } }; + html! { <div class="room-list-item"> <a onclick=self.link.callback(move |e: MouseEvent| Msg::ChangeRoom(room.clone()))>