about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/database/file/mod.rs17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/database/file/mod.rs b/src/database/file/mod.rs
index 853240a..64d9564 100644
--- a/src/database/file/mod.rs
+++ b/src/database/file/mod.rs
@@ -489,17 +489,16 @@ impl Storage for FileStorage {
             if let Some(mut feed) = filter_post(feed, user) {
                 if feed["children"].is_array() {
                     let children = feed["children"].as_array().unwrap().clone();
-                    let mut posts_iter = children
+                    let posts_iter = children
                         .into_iter()
-                        .map(|s: serde_json::Value| s.as_str().unwrap().to_string());
-                    if after.is_some() {
-                        loop {
-                            let i = posts_iter.next();
-                            if &i == after {
-                                break;
+                        .map(|s: serde_json::Value| s.as_str().unwrap().to_string())
+                        .skip_while(|s: &String| {
+                            if let Some(after) = after {
+                                s != after
+                            } else {
+                                false
                             }
-                        }
-                    }
+                        });
                     let posts = stream::iter(posts_iter)
                         .map(|url: String| async move { self.get_post(&url).await })
                         .buffered(std::cmp::min(3, limit))