refactor: do not get domains as often

This commit is contained in:
Moritz Böhme 2025-10-03 17:19:56 +02:00
parent d2fa95d1e4
commit d82dbfdd43
No known key found for this signature in database
GPG key ID: 970C6E89EB0547A9

View file

@ -30,7 +30,7 @@ async fn complete_channel(mut channel: Channel, client: &Client) -> Result<Box<C
let grouped: Vec<(Option<String>, Vec<rss::Item>)> = channel
.items()
.iter()
.sorted_by(|a, b| get_domain(a).cmp(&get_domain(b)))
.sorted_by_cached_key(|a| get_domain(a))
.chunk_by(|&item| get_domain(item))
.into_iter()
.map(|(k, v)| (k, v.cloned().collect()))