[fractal] fractal-matrix-api: Drop redundant function call



commit 903ee29aeab8c335c857a0585482403dc73322eb
Author: Zeeshan Ali <zeenix collabora co uk>
Date:   Mon Dec 10 17:15:41 2018 +0100

    fractal-matrix-api: Drop redundant function call
    
    Fixing clippy error:
    
    ```
    error: called `filter(p).next()` on an `Iterator`. This is more succinctly expressed by calling 
`.find(p)` instead.
       --> fractal-matrix-api/src/util.rs:243:34
        |
    243 |               if let Some(fread) = evs
        |  __________________________________^
    244 | |                 .into_iter()
    245 | |                 .filter(|x| x["type"] == "m.fully_read")
    246 | |                 .next()
        | |_______________________^
        |
        = note: `-D clippy::filter-next` implied by `-D warnings`
        = note: replace `filter(|x| x["type"] == "m.fully_read").next()` with `find(|x| x["type"] == 
"m.fully_read")`
        = help: for further information visit 
https://rust-lang-nursery.github.io/rust-clippy/master/index.html#filter_next
    ```
    
    Related: #370

 fractal-matrix-api/src/util.rs | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
---
diff --git a/fractal-matrix-api/src/util.rs b/fractal-matrix-api/src/util.rs
index 9f079d1..ec4b619 100644
--- a/fractal-matrix-api/src/util.rs
+++ b/fractal-matrix-api/src/util.rs
@@ -240,11 +240,7 @@ pub fn get_rooms_from_json(r: &JsonValue, userid: &str, baseu: &Url) -> Result<V
         }
         // Adding fully read to the receipts events
         if let Some(evs) = dataevs.as_array() {
-            if let Some(fread) = evs
-                .into_iter()
-                .filter(|x| x["type"] == "m.fully_read")
-                .next()
-            {
+            if let Some(fread) = evs.into_iter().find(|x| x["type"] == "m.fully_read") {
                 fread["content"]["event_id"]
                     .as_str()
                     .map(|ev| r.add_receipt_from_fully_read(userid, ev));


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]