Skip to content

Commit

Permalink
style: 清空 clippy 提示
Browse files Browse the repository at this point in the history
  • Loading branch information
amtoaer committed Jan 11, 2025
1 parent 0113bf7 commit 368b9ef
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 13 deletions.
21 changes: 11 additions & 10 deletions crates/bili_sync/src/bilibili/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,17 +69,18 @@ pub struct BiliClient {
impl BiliClient {
pub fn new() -> Self {
let client = Client::new();
let limiter = match CONFIG.concurrent_limit.rate_limit {
Some(RateLimit { limit, duration }) => Some(
let limiter = CONFIG
.concurrent_limit
.rate_limit
.as_ref()
.map(|RateLimit { limit, duration }| {
RateLimiter::builder()
.initial(limit)
.refill(limit)
.max(limit)
.interval(Duration::from_secs(duration))
.build(),
),
None => None,
};
.initial(*limit)
.refill(*limit)
.max(*limit)
.interval(Duration::from_secs(*duration))
.build()
});
Self { client, limiter }
}

Expand Down
2 changes: 1 addition & 1 deletion crates/bili_sync/src/bilibili/video.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ impl<'a> Video<'a> {
.error_for_status()?;
let headers = std::mem::take(res.headers_mut());
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!(
"unexpected content type: {:?}, body: {:?}",
content_type,
Expand Down
2 changes: 1 addition & 1 deletion crates/bili_sync/src/config/global.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub static CONFIG: Lazy<Config> = Lazy::new(|| {
let config = Config::load().unwrap_or_else(|err| {
if err
.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}");
}
Expand Down
2 changes: 1 addition & 1 deletion crates/bili_sync/src/utils/nfo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pub struct NFOSerializer<'a>(pub ModelWrapper<'a>, pub NFOMode);

/// serde xml 似乎不太好用,先这么裸着写
/// (真是又臭又长啊
impl<'a> NFOSerializer<'a> {
impl NFOSerializer<'_> {
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"?>
"#
Expand Down

0 comments on commit 368b9ef

Please sign in to comment.