Skip to content

Commit 1a23ce1

Browse files
committed
Bump Rust edition to 2024 from 2021
1 parent a83f4b5 commit 1a23ce1

File tree

22 files changed

+94
-85
lines changed

22 files changed

+94
-85
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "closely"
33
version = "0.1.24"
4-
edition = "2021"
4+
edition = "2024"
55
publish = false
66

77
[dependencies]

src/config/accounts.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use std::{
2-
collections::{hash_map::Values, HashMap},
2+
collections::{HashMap, hash_map::Values},
33
fmt,
44
};
55

src/config/mod.rs

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -619,10 +619,11 @@ platform = { name = "bilibili.live", user_id = 123456 }
619619
notify = []
620620
"#,
621621
|c| {
622-
assert!(c
623-
.unwrap_err()
624-
.to_string()
625-
.ends_with("reference of notify not found 'reporter_notify'"))
622+
assert!(
623+
c.unwrap_err()
624+
.to_string()
625+
.ends_with("reference of notify not found 'reporter_notify'")
626+
)
626627
},
627628
);
628629

@@ -635,10 +636,11 @@ platform = { name = "bilibili.live", user_id = 123456 }
635636
notify = ["meow"]
636637
"#,
637638
|c| {
638-
assert!(c
639-
.unwrap_err()
640-
.to_string()
641-
.ends_with("reference of notify not found 'meow'"))
639+
assert!(
640+
c.unwrap_err()
641+
.to_string()
642+
.ends_with("reference of notify not found 'meow'")
643+
)
642644
},
643645
);
644646

@@ -654,10 +656,11 @@ platform = { name = "bilibili.live", user_id = 123456 }
654656
notify = ["meow", "woof"]
655657
"#,
656658
|c| {
657-
assert!(c
658-
.unwrap_err()
659-
.to_string()
660-
.ends_with("reference of notify not found 'woof'"))
659+
assert!(
660+
c.unwrap_err()
661+
.to_string()
662+
.ends_with("reference of notify not found 'woof'")
663+
)
661664
},
662665
);
663666

@@ -673,10 +676,11 @@ platform = { name = "bilibili.live", user_id = 123456 }
673676
notify = ["meow"]
674677
"#,
675678
|c| {
676-
assert!(c
677-
.unwrap_err()
678-
.to_string()
679-
.ends_with("both token in global and notify are missing"))
679+
assert!(
680+
c.unwrap_err()
681+
.to_string()
682+
.ends_with("both token in global and notify are missing")
683+
)
680684
},
681685
);
682686
}

src/notify/shared.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use std::{
2-
collections::{hash_map::Entry, HashMap},
2+
collections::{HashMap, hash_map::Entry},
33
sync::{Arc, LazyLock, Mutex as StdMutex},
44
};
55

src/platform/bilibili/source/live.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use serde_json::{self as json, json};
1212
use spdlog::critical;
1313
use tokio::sync::Mutex;
1414

15-
use super::super::{bilibili_request_builder, upgrade_to_https, Response};
15+
use super::super::{Response, bilibili_request_builder, upgrade_to_https};
1616
use crate::{
1717
config::{Accessor, Validator},
1818
platform::{PlatformMetadata, PlatformTrait, PlatformTraitStatic},

src/platform/bilibili/source/playback/bililive_recorder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use serde_json as json;
1010
use spdlog::prelude::*;
1111
use tokio::{
1212
fs,
13-
sync::{mpsc, Mutex},
13+
sync::{Mutex, mpsc},
1414
};
1515
use warp::Filter;
1616

src/platform/bilibili/source/space.rs

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@ use std::{
1111

1212
use anyhow::{anyhow, bail, ensure};
1313
use chrono::DateTime;
14-
use reqwest::{header::COOKIE, Url};
14+
use reqwest::{Url, header::COOKIE};
1515
use serde::Deserialize;
1616
use serde_json::{self as json};
1717
use spdlog::prelude::*;
1818
use tokio::sync::Mutex;
1919

20-
use super::super::{upgrade_to_https, Response};
20+
use super::super::{Response, upgrade_to_https};
2121
use crate::{
2222
config::{Accessor, AsSecretRef, Config, Validator},
23-
platform::{bilibili::bilibili_request_builder, PlatformMetadata, PlatformTraitStatic},
23+
platform::{PlatformMetadata, PlatformTraitStatic, bilibili::bilibili_request_builder},
2424
prop,
2525
source::{
2626
FetcherTrait, Post, PostAttachment, PostAttachmentImage, PostContent, PostUrl, PostUrls,
@@ -981,25 +981,23 @@ mod tests {
981981
let history = fetch_space_history(8047632, &mut blocked, None)
982982
.await
983983
.unwrap();
984-
assert!(history.0.iter().all(|post| !post
985-
.urls
986-
.major()
987-
.as_clickable()
988-
.unwrap()
989-
.url
990-
.is_empty()));
984+
assert!(
985+
history
986+
.0
987+
.iter()
988+
.all(|post| !post.urls.major().as_clickable().unwrap().url.is_empty())
989+
);
991990
assert!(history.0.iter().all(|post| !post.content.is_empty()));
992991

993992
let history = fetch_space_history(178362496, &mut blocked, None)
994993
.await
995994
.unwrap();
996-
assert!(history.0.iter().all(|post| !post
997-
.urls
998-
.major()
999-
.as_clickable()
1000-
.unwrap()
1001-
.url
1002-
.is_empty()));
995+
assert!(
996+
history
997+
.0
998+
.iter()
999+
.all(|post| !post.urls.major().as_clickable().unwrap().url.is_empty())
1000+
);
10031001
assert!(history.0.iter().all(|post| !post.content.is_empty()));
10041002
}
10051003
}

src/platform/bilibili/source/video.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use chrono::DateTime;
55
use serde::Deserialize;
66
use serde_json as json;
77

8-
use super::super::{bilibili_request_builder, upgrade_to_https, Response};
8+
use super::super::{Response, bilibili_request_builder, upgrade_to_https};
99
use crate::{
1010
config::{Accessor, Validator},
1111
platform::{PlatformMetadata, PlatformTraitStatic},
@@ -171,13 +171,12 @@ mod tests {
171171
async fn deser() {
172172
let videos = fetch_series_archives(522384919, 3747026).await.unwrap();
173173

174-
assert!(videos.0.iter().all(|post| !post
175-
.urls
176-
.major()
177-
.as_clickable()
178-
.unwrap()
179-
.url
180-
.is_empty()));
174+
assert!(
175+
videos
176+
.0
177+
.iter()
178+
.all(|post| !post.urls.major().as_clickable().unwrap().url.is_empty())
179+
);
181180
assert!(videos.0.iter().all(|post| !post.content.is_empty()));
182181
}
183182
}

src/platform/github/source/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::{fmt, future::Future, pin::Pin};
22

3-
use anyhow::{anyhow, ensure, Ok};
3+
use anyhow::{Ok, anyhow, ensure};
44
use serde::Deserialize;
55

66
use crate::{

src/platform/qq/notify/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use anyhow::{anyhow, ensure};
44
use serde::Deserialize;
55
use spdlog::prelude::*;
66

7-
use super::{onebot11, ConfigChat};
7+
use super::{ConfigChat, onebot11};
88
use crate::{
99
config::{self, Accessor, AccountRef, Config, ContextualValidator, Overridable, Validator},
1010
format_if, helper,

0 commit comments

Comments
 (0)