fix: sort items before chunking
The chunk_by function works like coreutils sort in that it expects sorted inputs.
This commit is contained in:
parent
0f08e877e4
commit
80a6cefbeb
1 changed files with 2 additions and 1 deletions
|
|
@ -27,7 +27,8 @@ async fn complete(mut channel: Channel, client: &Client) -> Result<Box<Channel>>
|
||||||
let grouped: Vec<Vec<rss::Item>> = channel
|
let grouped: Vec<Vec<rss::Item>> = channel
|
||||||
.items()
|
.items()
|
||||||
.iter()
|
.iter()
|
||||||
.chunk_by(|item| get_domain(item))
|
.sorted_by(|a, b| get_domain(a).cmp(&get_domain(b)))
|
||||||
|
.chunk_by(|&item| get_domain(item))
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|(_k, v)| v.cloned().collect())
|
.map(|(_k, v)| v.cloned().collect())
|
||||||
.collect();
|
.collect();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue