diff --git a/crates/bili_sync/src/api/helper.rs b/crates/bili_sync/src/api/helper.rs index 48f7d1b..296e1c6 100644 --- a/crates/bili_sync/src/api/helper.rs +++ b/crates/bili_sync/src/api/helper.rs @@ -116,10 +116,7 @@ async fn execute_page_update_batch( txn: &DatabaseTransaction, pages: impl Iterator, ) -> Result<(), sea_orm::DbErr> { - let values = pages - .map(|p| format!("({}, {})", p.0, p.1)) - .collect::>() - .join(", "); + let values = pages.map(|p| format!("({}, {})", p.0, p.1)).join(", "); if values.is_empty() { return Ok(()); } diff --git a/crates/bili_sync/src/api/routes/video_sources/mod.rs b/crates/bili_sync/src/api/routes/video_sources/mod.rs index e8b5cf3..4616b83 100644 --- a/crates/bili_sync/src/api/routes/video_sources/mod.rs +++ b/crates/bili_sync/src/api/routes/video_sources/mod.rs @@ -7,6 +7,7 @@ use axum::routing::{get, post, put}; use bili_sync_entity::rule::Rule; use bili_sync_entity::*; use bili_sync_migration::Expr; +use itertools::Itertools; use sea_orm::ActiveValue::Set; use sea_orm::entity::prelude::*; use sea_orm::{ColumnTrait, DatabaseConnection, EntityTrait, QuerySelect, QueryTrait, TransactionTrait}; @@ -347,11 +348,7 @@ pub async fn evaluate_video_source( SET should_download = tempdata.should_download \ FROM tempdata \ WHERE video.id = tempdata.id", - chunk - .iter() - .map(|item| format!("({}, {})", item.0, item.1)) - .collect::>() - .join(", ") + chunk.iter().map(|item| format!("({}, {})", item.0, item.1)).join(", ") ); txn.execute_unprepared(&sql).await?; } diff --git a/crates/bili_sync/src/config/current.rs b/crates/bili_sync/src/config/current.rs index 1824934..01ca01d 100644 --- a/crates/bili_sync/src/config/current.rs +++ b/crates/bili_sync/src/config/current.rs @@ -3,6 +3,7 @@ use std::sync::{Arc, LazyLock}; use anyhow::{Result, bail}; use croner::parser::CronParser; +use itertools::Itertools; use sea_orm::DatabaseConnection; use serde::{Deserialize, Serialize}; use validator::Validate; @@ -103,13 +104,7 @@ impl Config { } }; if !errors.is_empty() { - bail!( - errors - .into_iter() - .map(|e| format!("- {}", e)) - .collect::>() - .join("\n") - ); + bail!(errors.into_iter().map(|e| format!("- {}", e)).join("\n")); } Ok(()) }