mirror of
https://github.com/TheFunny/TelegramTwitterMediaBot.git
synced 2026-10-06 01:22:16 +00:00
refactor(send): inline parse_media_url, drop photos_first's rebind
parse_media_url had a single caller (input_file_for) and read better as the one expression it wrapped; photos_first rebound its argument only to gain mut.
This commit is contained in:
@@ -349,8 +349,7 @@ pub fn chunk_media_items<T>(items: Vec<T>) -> Vec<Vec<T>> {
|
||||
/// mixed, the first item must be a photo (Telegram's sendMediaGroup rule).
|
||||
/// Stable sort keeps the source order within each kind; a lone animation is
|
||||
/// untouched (it takes the SendAnimation path before this runs).
|
||||
pub fn photos_first(items: Vec<MediaItemPayload>) -> Vec<MediaItemPayload> {
|
||||
let mut items = items;
|
||||
pub fn photos_first(mut items: Vec<MediaItemPayload>) -> Vec<MediaItemPayload> {
|
||||
items.sort_by_key(|item| match item {
|
||||
MediaItemPayload::Photo { .. } => 0,
|
||||
MediaItemPayload::Video { .. } | MediaItemPayload::Animation { .. } => 1,
|
||||
|
||||
Reference in New Issue
Block a user