fractal-matrix-api: Drop redundant closures
Fixing clippy error: ``` error: redundant closure found --> fractal-matrix-api/src/util.rs:219:60 | 219 | r.prev_batch = timeline["prev_batch"].as_str().map(|s| String::from(s)); | ^^^^^^^^^^^^^^^^^^^ help: remove closure as shown: `String::from` | = note: `-D clippy::redundant-closure` implied by `-D warnings` = help: for further information visit https://rust-lang-nursery.github.io/rust-clippy/master/index.html#redundant_closure ``` Related: #370
This commit is contained in:
parent
14e7d2fcf5
commit
4d34eed4ab
3 changed files with 4 additions and 4 deletions
|
@ -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();
|
||||
},
|
||||
|
|
|
@ -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" => {
|
||||
|
|
|
@ -216,7 +216,7 @@ pub fn get_rooms_from_json(r: &JsonValue, userid: &str, baseu: &Url) -> Result<V
|
|||
.as_i64()
|
||||
.unwrap_or(0) as i32;
|
||||
|
||||
r.prev_batch = timeline["prev_batch"].as_str().map(|s| String::from(s));
|
||||
r.prev_batch = timeline["prev_batch"].as_str().map(String::from);
|
||||
|
||||
if let Some(ev) = dataevs.as_array() {
|
||||
for tag in ev.iter().filter(|x| x["type"] == "m.tag") {
|
||||
|
|
Loading…
Reference in a new issue