mirror of
https://github.com/amtoaer/bili-sync.git
synced 2026-09-05 23:49:53 +08:00
style: 清空 clippy 提示
This commit is contained in:
@@ -69,17 +69,18 @@ pub struct BiliClient {
|
|||||||
impl BiliClient {
|
impl BiliClient {
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
let client = Client::new();
|
let client = Client::new();
|
||||||
let limiter = match CONFIG.concurrent_limit.rate_limit {
|
let limiter = CONFIG
|
||||||
Some(RateLimit { limit, duration }) => Some(
|
.concurrent_limit
|
||||||
|
.rate_limit
|
||||||
|
.as_ref()
|
||||||
|
.map(|RateLimit { limit, duration }| {
|
||||||
RateLimiter::builder()
|
RateLimiter::builder()
|
||||||
.initial(limit)
|
.initial(*limit)
|
||||||
.refill(limit)
|
.refill(*limit)
|
||||||
.max(limit)
|
.max(*limit)
|
||||||
.interval(Duration::from_secs(duration))
|
.interval(Duration::from_secs(*duration))
|
||||||
.build(),
|
.build()
|
||||||
),
|
});
|
||||||
None => None,
|
|
||||||
};
|
|
||||||
Self { client, limiter }
|
Self { client, limiter }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ impl<'a> Video<'a> {
|
|||||||
.error_for_status()?;
|
.error_for_status()?;
|
||||||
let headers = std::mem::take(res.headers_mut());
|
let headers = std::mem::take(res.headers_mut());
|
||||||
let content_type = headers.get("content-type");
|
let content_type = headers.get("content-type");
|
||||||
if !content_type.is_some_and(|v| v == "application/octet-stream") {
|
if content_type.is_none_or(|v| v != "application/octet-stream") {
|
||||||
bail!(
|
bail!(
|
||||||
"unexpected content type: {:?}, body: {:?}",
|
"unexpected content type: {:?}, body: {:?}",
|
||||||
content_type,
|
content_type,
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ pub static CONFIG: Lazy<Config> = Lazy::new(|| {
|
|||||||
let config = Config::load().unwrap_or_else(|err| {
|
let config = Config::load().unwrap_or_else(|err| {
|
||||||
if err
|
if err
|
||||||
.downcast_ref::<std::io::Error>()
|
.downcast_ref::<std::io::Error>()
|
||||||
.map_or(true, |e| e.kind() != std::io::ErrorKind::NotFound)
|
.is_none_or(|e| e.kind() != std::io::ErrorKind::NotFound)
|
||||||
{
|
{
|
||||||
panic!("加载配置文件失败,错误为: {err}");
|
panic!("加载配置文件失败,错误为: {err}");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ pub struct NFOSerializer<'a>(pub ModelWrapper<'a>, pub NFOMode);
|
|||||||
|
|
||||||
/// serde xml 似乎不太好用,先这么裸着写
|
/// serde xml 似乎不太好用,先这么裸着写
|
||||||
/// (真是又臭又长啊
|
/// (真是又臭又长啊
|
||||||
impl<'a> NFOSerializer<'a> {
|
impl NFOSerializer<'_> {
|
||||||
pub async fn generate_nfo(self, nfo_time_type: &NFOTimeType) -> Result<String> {
|
pub async fn generate_nfo(self, nfo_time_type: &NFOTimeType) -> Result<String> {
|
||||||
let mut buffer = r#"<?xml version="1.0" encoding="utf-8" standalone="yes"?>
|
let mut buffer = r#"<?xml version="1.0" encoding="utf-8" standalone="yes"?>
|
||||||
"#
|
"#
|
||||||
|
|||||||
Reference in New Issue
Block a user