Linter changes
This commit is contained in:
parent
079e9f5e11
commit
40e142ccc7
6 changed files with 29 additions and 56 deletions
src/bot
|
@ -21,7 +21,7 @@ pub(crate) async fn run(data: Arc<RwLock<SharedData>>){
|
|||
let mut last_reload: DateTime<Utc>;
|
||||
let mut lemmy: Lemmy;
|
||||
let mut login_error: bool;
|
||||
let communities: HashMap<String, CommunityId>;
|
||||
let mut communities = HashMap::new();
|
||||
{
|
||||
let mut shared_data = data.write().await;
|
||||
|
||||
|
@ -38,14 +38,9 @@ pub(crate) async fn run(data: Arc<RwLock<SharedData>>){
|
|||
Err(e) => panic!("{}", e),
|
||||
};
|
||||
login_error = false;
|
||||
|
||||
communities = match lemmy.get_communities().await {
|
||||
Ok(data) => data,
|
||||
Err(e) => panic!("{}", e),
|
||||
};
|
||||
}
|
||||
|
||||
while (Utc::now().naive_local().second() != 30) {
|
||||
while Utc::now().naive_local().second() != 30 {
|
||||
sleep(Duration::milliseconds(100).to_std().unwrap()).await;
|
||||
}
|
||||
|
||||
|
@ -75,7 +70,7 @@ pub(crate) async fn run(data: Arc<RwLock<SharedData>>){
|
|||
}
|
||||
|
||||
if shared_data.start - last_reload > Duration::seconds(shared_data.config.config_reload_seconds as i64) {
|
||||
let communities = match lemmy.get_communities().await {
|
||||
communities = match lemmy.get_communities().await {
|
||||
Ok(data) => data,
|
||||
Err(e) => {
|
||||
login_error = true;
|
||||
|
@ -106,7 +101,7 @@ pub(crate) async fn run(data: Arc<RwLock<SharedData>>){
|
|||
};
|
||||
}
|
||||
|
||||
let down = shared_data.downgrade();
|
||||
let _ = shared_data.downgrade();
|
||||
|
||||
idle(&data).await;
|
||||
}
|
||||
|
@ -172,7 +167,7 @@ async fn handle_series<'a>(
|
|||
|
||||
let post_data = CustomCreatePost {
|
||||
name: post_lemmy_info.title,
|
||||
community_id: community_id,
|
||||
community_id,
|
||||
url: Some(post_lemmy_info.url),
|
||||
body: post_body,
|
||||
honeypot: None,
|
||||
|
@ -184,7 +179,7 @@ async fn handle_series<'a>(
|
|||
|
||||
if post_series_config.pin_settings.pin_new_post_community {
|
||||
let pinned_posts = lemmy.get_community_pinned(community_id).await?;
|
||||
if pinned_posts.len() > 0 {
|
||||
if !pinned_posts.is_empty() {
|
||||
let community_pinned_post = &pinned_posts[0];
|
||||
lemmy.unpin(community_pinned_post.post.id, PostFeatureType::Community).await?;
|
||||
}
|
||||
|
@ -193,7 +188,7 @@ async fn handle_series<'a>(
|
|||
|
||||
if post_series_config.pin_settings.pin_new_post_local {
|
||||
let pinned_posts = lemmy.get_local_pinned().await?;
|
||||
if pinned_posts.len() > 0 {
|
||||
if !pinned_posts.is_empty() {
|
||||
let community_pinned_post = &pinned_posts[0];
|
||||
lemmy.unpin(community_pinned_post.post.id, PostFeatureType::Local).await?;
|
||||
}
|
||||
|
@ -214,7 +209,7 @@ async fn handle_series<'a>(
|
|||
|
||||
series_history.set_part(post_part_info.as_string().as_str(), part_history);
|
||||
data.post_history.set_series(series.slug.as_str(), series_history);
|
||||
data.post_history.save_history();
|
||||
let _ = data.post_history.save_history();
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue