diff options
Diffstat (limited to 'src/database/file/mod.rs')
-rw-r--r-- | src/database/file/mod.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/database/file/mod.rs b/src/database/file/mod.rs index 4a40f38..f9588f5 100644 --- a/src/database/file/mod.rs +++ b/src/database/file/mod.rs @@ -483,16 +483,20 @@ impl Storage for FileStorage { if let Some(feed) = self.get_post(url).await? { if let Some(mut feed) = filter_post(feed, user) { if feed["children"].is_array() { + // This code contains several clones. It looks + // like the borrow checker thinks it is preventing + // me from doing something incredibly stupid. The + // borrow checker may or may not be right. let children = feed["children"].as_array().unwrap().clone(); let mut posts_iter = children .into_iter() .map(|s: serde_json::Value| s.as_str().unwrap().to_string()); // Note: we can't actually use skip_while here because we end up emitting `after`. // This imperative snippet consumes after instead of emitting it, allowing the - // stream of posts to return only those items that truly come *after*. + // stream of posts to return only those items that truly come *after* if let Some(after) = after { for s in posts_iter.by_ref() { - if &s != after { + if &s == after { break } } |