diff --git a/fractal-matrix-api/src/backend/room.rs b/fractal-matrix-api/src/backend/room.rs index c3c0af80..911e2b06 100644 --- a/fractal-matrix-api/src/backend/room.rs +++ b/fractal-matrix-api/src/backend/room.rs @@ -140,7 +140,7 @@ pub fn get_room_messages(bk: &Backend, roomid: String, from: String) -> Result<( let array = r["chunk"].as_array(); let evs = array.unwrap().iter().rev(); let list = Message::from_json_events_iter(roomid.clone(), evs); - let prev_batch = r["end"].as_str().map(|s| String::from(s)); + let prev_batch = r["end"].as_str().map(String::from); tx.send(BKResponse::RoomMessagesTo(list, roomid, prev_batch)) .unwrap(); }, diff --git a/fractal-matrix-api/src/model/message.rs b/fractal-matrix-api/src/model/message.rs index d50c7359..2a7bc946 100644 --- a/fractal-matrix-api/src/model/message.rs +++ b/fractal-matrix-api/src/model/message.rs @@ -152,8 +152,8 @@ impl Message { fn parse_m_room_message(msg: &mut Message, c: &JsonValue) { let mtype = c["msgtype"].as_str().unwrap_or(""); let body = c["body"].as_str().unwrap_or(""); - let formatted_body = c["formatted_body"].as_str().map(|s| String::from(s)); - let format = c["format"].as_str().map(|s| String::from(s)); + let formatted_body = c["formatted_body"].as_str().map(String::from); + let format = c["format"].as_str().map(String::from); match mtype { "m.image" | "m.file" | "m.video" | "m.audio" => { diff --git a/fractal-matrix-api/src/util.rs b/fractal-matrix-api/src/util.rs index 07cffed9..42b270a0 100644 --- a/fractal-matrix-api/src/util.rs +++ b/fractal-matrix-api/src/util.rs @@ -216,7 +216,7 @@ pub fn get_rooms_from_json(r: &JsonValue, userid: &str, baseu: &Url) -> Result