diff --git a/.rustfmt.toml b/.rustfmt.toml index f3efdc308..f01b84685 100644 --- a/.rustfmt.toml +++ b/.rustfmt.toml @@ -1,5 +1,5 @@ tab_spaces = 2 edition="2018" -imports_layout="HorizontalVertical" -merge_imports=true +# imports_layout="HorizontalVertical" +# merge_imports=true reorder_imports=true diff --git a/lemmy_api_structs/src/site.rs b/lemmy_api_structs/src/site.rs index b82b325e3..8de1ab7ad 100644 --- a/lemmy_api_structs/src/site.rs +++ b/lemmy_api_structs/src/site.rs @@ -1,12 +1,6 @@ use lemmy_db::{ - category::*, - comment_view::*, - community_view::*, - moderator_views::*, - post_view::*, - site_view::*, - user::*, - user_view::*, + category::*, comment_view::*, community_view::*, moderator_views::*, post_view::*, site_view::*, + user::*, user_view::*, }; use serde::{Deserialize, Serialize}; diff --git a/lemmy_db/src/activity.rs b/lemmy_db/src/activity.rs index 6a5beb3bb..6a263b2bb 100644 --- a/lemmy_db/src/activity.rs +++ b/lemmy_db/src/activity.rs @@ -1,7 +1,7 @@ use crate::{schema::activity, Crud}; use diesel::{dsl::*, result::Error, *}; use log::debug; -use serde::{Serialize}; +use serde::Serialize; use serde_json::Value; use std::{ fmt::Debug, @@ -85,9 +85,7 @@ mod tests { activity::{Activity, ActivityForm}, tests::establish_unpooled_connection, user::{UserForm, User_}, - Crud, - ListingType, - SortType, + Crud, ListingType, SortType, }; use serde_json::Value; diff --git a/lemmy_db/src/category.rs b/lemmy_db/src/category.rs index c4165c22f..36beb9ff6 100644 --- a/lemmy_db/src/category.rs +++ b/lemmy_db/src/category.rs @@ -3,7 +3,7 @@ use crate::{ Crud, }; use diesel::{dsl::*, result::Error, *}; -use serde::{Serialize}; +use serde::Serialize; #[derive(Queryable, Identifiable, PartialEq, Debug, Serialize)] #[table_name = "category"] diff --git a/lemmy_db/src/comment.rs b/lemmy_db/src/comment.rs index bc2a574ec..3e24346d9 100644 --- a/lemmy_db/src/comment.rs +++ b/lemmy_db/src/comment.rs @@ -2,9 +2,7 @@ use super::post::Post; use crate::{ naive_now, schema::{comment, comment_like, comment_saved}, - Crud, - Likeable, - Saveable, + Crud, Likeable, Saveable, }; use diesel::{dsl::*, result::Error, *}; use url::{ParseError, Url}; @@ -257,14 +255,8 @@ impl Saveable for CommentSaved { #[cfg(test)] mod tests { use crate::{ - comment::*, - community::*, - post::*, - tests::establish_unpooled_connection, - user::*, - Crud, - ListingType, - SortType, + comment::*, community::*, post::*, tests::establish_unpooled_connection, user::*, Crud, + ListingType, SortType, }; #[test] diff --git a/lemmy_db/src/comment_view.rs b/lemmy_db/src/comment_view.rs index 843c026b3..5ef5223af 100644 --- a/lemmy_db/src/comment_view.rs +++ b/lemmy_db/src/comment_view.rs @@ -84,9 +84,7 @@ table! { } } -#[derive( - Queryable, Identifiable, PartialEq, Debug, Serialize, QueryableByName, Clone, -)] +#[derive(Queryable, Identifiable, PartialEq, Debug, Serialize, QueryableByName, Clone)] #[table_name = "comment_fast_view"] pub struct CommentView { pub id: i32, @@ -497,15 +495,8 @@ impl<'a> ReplyQueryBuilder<'a> { #[cfg(test)] mod tests { use crate::{ - comment::*, - comment_view::*, - community::*, - post::*, - tests::establish_unpooled_connection, - user::*, - Crud, - Likeable, - *, + comment::*, comment_view::*, community::*, post::*, tests::establish_unpooled_connection, + user::*, Crud, Likeable, *, }; #[test] diff --git a/lemmy_db/src/community.rs b/lemmy_db/src/community.rs index 918d44f15..dbb0cfede 100644 --- a/lemmy_db/src/community.rs +++ b/lemmy_db/src/community.rs @@ -1,10 +1,7 @@ use crate::{ naive_now, schema::{community, community_follower, community_moderator, community_user_ban}, - Bannable, - Crud, - Followable, - Joinable, + Bannable, Crud, Followable, Joinable, }; use diesel::{dsl::*, result::Error, *}; diff --git a/lemmy_db/src/community_view.rs b/lemmy_db/src/community_view.rs index 1ecca0a1f..a6355504d 100644 --- a/lemmy_db/src/community_view.rs +++ b/lemmy_db/src/community_view.rs @@ -123,9 +123,7 @@ table! { } } -#[derive( - Queryable, Identifiable, PartialEq, Debug, Serialize, QueryableByName, Clone, -)] +#[derive(Queryable, Identifiable, PartialEq, Debug, Serialize, QueryableByName, Clone)] #[table_name = "community_fast_view"] pub struct CommunityView { pub id: i32, diff --git a/lemmy_db/src/moderator.rs b/lemmy_db/src/moderator.rs index aaed1314d..a0947c831 100644 --- a/lemmy_db/src/moderator.rs +++ b/lemmy_db/src/moderator.rs @@ -1,14 +1,7 @@ use crate::{ schema::{ - mod_add, - mod_add_community, - mod_ban, - mod_ban_from_community, - mod_lock_post, - mod_remove_comment, - mod_remove_community, - mod_remove_post, - mod_sticky_post, + mod_add, mod_add_community, mod_ban, mod_ban_from_community, mod_lock_post, mod_remove_comment, + mod_remove_community, mod_remove_post, mod_sticky_post, }, Crud, }; @@ -392,14 +385,8 @@ impl Crud for ModAdd { #[cfg(test)] mod tests { use crate::{ - comment::*, - community::*, - moderator::*, - post::*, - tests::establish_unpooled_connection, - user::*, - ListingType, - SortType, + comment::*, community::*, moderator::*, post::*, tests::establish_unpooled_connection, user::*, + ListingType, SortType, }; // use Crud; diff --git a/lemmy_db/src/moderator_views.rs b/lemmy_db/src/moderator_views.rs index 7054a05a0..efa949a4a 100644 --- a/lemmy_db/src/moderator_views.rs +++ b/lemmy_db/src/moderator_views.rs @@ -1,6 +1,6 @@ use crate::limit_and_offset; use diesel::{result::Error, *}; -use serde::{Serialize}; +use serde::Serialize; table! { mod_remove_post_view (id) { @@ -17,9 +17,7 @@ table! { } } -#[derive( - Queryable, Identifiable, PartialEq, Debug, Serialize, QueryableByName, Clone, -)] +#[derive(Queryable, Identifiable, PartialEq, Debug, Serialize, QueryableByName, Clone)] #[table_name = "mod_remove_post_view"] pub struct ModRemovePostView { pub id: i32, @@ -77,9 +75,7 @@ table! { } } -#[derive( - Queryable, Identifiable, PartialEq, Debug, Serialize, QueryableByName, Clone, -)] +#[derive(Queryable, Identifiable, PartialEq, Debug, Serialize, QueryableByName, Clone)] #[table_name = "mod_lock_post_view"] pub struct ModLockPostView { pub id: i32, @@ -136,9 +132,7 @@ table! { } } -#[derive( - Queryable, Identifiable, PartialEq, Debug, Serialize, QueryableByName, Clone, -)] +#[derive(Queryable, Identifiable, PartialEq, Debug, Serialize, QueryableByName, Clone)] #[table_name = "mod_sticky_post_view"] pub struct ModStickyPostView { pub id: i32, @@ -200,9 +194,7 @@ table! { } } -#[derive( - Queryable, Identifiable, PartialEq, Debug, Serialize, QueryableByName, Clone, -)] +#[derive(Queryable, Identifiable, PartialEq, Debug, Serialize, QueryableByName, Clone)] #[table_name = "mod_remove_comment_view"] pub struct ModRemoveCommentView { pub id: i32, @@ -264,9 +256,7 @@ table! { } } -#[derive( - Queryable, Identifiable, PartialEq, Debug, Serialize, QueryableByName, Clone, -)] +#[derive(Queryable, Identifiable, PartialEq, Debug, Serialize, QueryableByName, Clone)] #[table_name = "mod_remove_community_view"] pub struct ModRemoveCommunityView { pub id: i32, @@ -320,9 +310,7 @@ table! { } } -#[derive( - Queryable, Identifiable, PartialEq, Debug, Serialize, QueryableByName, Clone, -)] +#[derive(Queryable, Identifiable, PartialEq, Debug, Serialize, QueryableByName, Clone)] #[table_name = "mod_ban_from_community_view"] pub struct ModBanFromCommunityView { pub id: i32, @@ -381,9 +369,7 @@ table! { } } -#[derive( - Queryable, Identifiable, PartialEq, Debug, Serialize, QueryableByName, Clone, -)] +#[derive(Queryable, Identifiable, PartialEq, Debug, Serialize, QueryableByName, Clone)] #[table_name = "mod_ban_view"] pub struct ModBanView { pub id: i32, @@ -435,9 +421,7 @@ table! { } } -#[derive( - Queryable, Identifiable, PartialEq, Debug, Serialize, QueryableByName, Clone, -)] +#[derive(Queryable, Identifiable, PartialEq, Debug, Serialize, QueryableByName, Clone)] #[table_name = "mod_add_community_view"] pub struct ModAddCommunityView { pub id: i32, @@ -492,9 +476,7 @@ table! { } } -#[derive( - Queryable, Identifiable, PartialEq, Debug, Serialize, QueryableByName, Clone, -)] +#[derive(Queryable, Identifiable, PartialEq, Debug, Serialize, QueryableByName, Clone)] #[table_name = "mod_add_view"] pub struct ModAddView { pub id: i32, diff --git a/lemmy_db/src/password_reset_request.rs b/lemmy_db/src/password_reset_request.rs index fde47c98e..69281b742 100644 --- a/lemmy_db/src/password_reset_request.rs +++ b/lemmy_db/src/password_reset_request.rs @@ -80,11 +80,8 @@ impl PasswordResetRequest { mod tests { use super::super::user::*; use crate::{ - password_reset_request::PasswordResetRequest, - tests::establish_unpooled_connection, - Crud, - ListingType, - SortType, + password_reset_request::PasswordResetRequest, tests::establish_unpooled_connection, Crud, + ListingType, SortType, }; #[test] diff --git a/lemmy_db/src/post.rs b/lemmy_db/src/post.rs index 7d13eb806..a8c65bf22 100644 --- a/lemmy_db/src/post.rs +++ b/lemmy_db/src/post.rs @@ -1,10 +1,7 @@ use crate::{ naive_now, schema::{post, post_like, post_read, post_saved}, - Crud, - Likeable, - Readable, - Saveable, + Crud, Likeable, Readable, Saveable, }; use diesel::{dsl::*, result::Error, *}; use url::{ParseError, Url}; @@ -328,12 +325,7 @@ impl Readable for PostRead { #[cfg(test)] mod tests { use crate::{ - community::*, - post::*, - tests::establish_unpooled_connection, - user::*, - ListingType, - SortType, + community::*, post::*, tests::establish_unpooled_connection, user::*, ListingType, SortType, }; #[test] diff --git a/lemmy_db/src/post_view.rs b/lemmy_db/src/post_view.rs index da93ecdae..4d6455cb5 100644 --- a/lemmy_db/src/post_view.rs +++ b/lemmy_db/src/post_view.rs @@ -106,9 +106,7 @@ table! { } } -#[derive( - Queryable, Identifiable, PartialEq, Debug, Serialize, QueryableByName, Clone, -)] +#[derive(Queryable, Identifiable, PartialEq, Debug, Serialize, QueryableByName, Clone)] #[table_name = "post_fast_view"] pub struct PostView { pub id: i32, @@ -389,14 +387,8 @@ impl PostView { #[cfg(test)] mod tests { use crate::{ - community::*, - post::*, - post_view::*, - tests::establish_unpooled_connection, - user::*, - Crud, - Likeable, - *, + community::*, post::*, post_view::*, tests::establish_unpooled_connection, user::*, Crud, + Likeable, *, }; #[test] diff --git a/lemmy_db/src/private_message.rs b/lemmy_db/src/private_message.rs index 2484ebeab..012f7356c 100644 --- a/lemmy_db/src/private_message.rs +++ b/lemmy_db/src/private_message.rs @@ -137,11 +137,7 @@ impl PrivateMessage { #[cfg(test)] mod tests { use crate::{ - private_message::*, - tests::establish_unpooled_connection, - user::*, - ListingType, - SortType, + private_message::*, tests::establish_unpooled_connection, user::*, ListingType, SortType, }; #[test] diff --git a/lemmy_db/src/private_message_view.rs b/lemmy_db/src/private_message_view.rs index 39fe66efa..68f7df42c 100644 --- a/lemmy_db/src/private_message_view.rs +++ b/lemmy_db/src/private_message_view.rs @@ -1,6 +1,6 @@ use crate::{limit_and_offset, MaybeOptional}; use diesel::{pg::Pg, result::Error, *}; -use serde::{Serialize}; +use serde::Serialize; // The faked schema since diesel doesn't do views table! { @@ -28,9 +28,7 @@ table! { } } -#[derive( - Queryable, Identifiable, PartialEq, Debug, Serialize, QueryableByName, Clone, -)] +#[derive(Queryable, Identifiable, PartialEq, Debug, Serialize, QueryableByName, Clone)] #[table_name = "private_message_view"] pub struct PrivateMessageView { pub id: i32, diff --git a/lemmy_db/src/site_view.rs b/lemmy_db/src/site_view.rs index 0edfd2b70..fd15ac778 100644 --- a/lemmy_db/src/site_view.rs +++ b/lemmy_db/src/site_view.rs @@ -1,5 +1,5 @@ use diesel::{result::Error, *}; -use serde::{Serialize}; +use serde::Serialize; table! { site_view (id) { @@ -24,9 +24,7 @@ table! { } } -#[derive( - Queryable, Identifiable, PartialEq, Debug, Serialize, QueryableByName, Clone, -)] +#[derive(Queryable, Identifiable, PartialEq, Debug, Serialize, QueryableByName, Clone)] #[table_name = "site_view"] pub struct SiteView { pub id: i32, diff --git a/lemmy_db/src/user.rs b/lemmy_db/src/user.rs index 247b5b360..a145999f6 100644 --- a/lemmy_db/src/user.rs +++ b/lemmy_db/src/user.rs @@ -1,12 +1,11 @@ use crate::{ - is_email_regex, - naive_now, + is_email_regex, naive_now, schema::{user_, user_::dsl::*}, Crud, }; use bcrypt::{hash, DEFAULT_COST}; use diesel::{dsl::*, result::Error, *}; -use serde::{Serialize}; +use serde::Serialize; #[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)] #[table_name = "user_"] diff --git a/lemmy_db/src/user_mention.rs b/lemmy_db/src/user_mention.rs index bcb3a1437..79e722cd7 100644 --- a/lemmy_db/src/user_mention.rs +++ b/lemmy_db/src/user_mention.rs @@ -73,14 +73,8 @@ impl UserMention { #[cfg(test)] mod tests { use crate::{ - comment::*, - community::*, - post::*, - tests::establish_unpooled_connection, - user::*, - user_mention::*, - ListingType, - SortType, + comment::*, community::*, post::*, tests::establish_unpooled_connection, user::*, + user_mention::*, ListingType, SortType, }; #[test] diff --git a/lemmy_db/src/user_mention_view.rs b/lemmy_db/src/user_mention_view.rs index c35ad3613..d1ce5ebd0 100644 --- a/lemmy_db/src/user_mention_view.rs +++ b/lemmy_db/src/user_mention_view.rs @@ -1,6 +1,6 @@ use crate::{limit_and_offset, MaybeOptional, SortType}; use diesel::{dsl::*, pg::Pg, result::Error, *}; -use serde::{Serialize}; +use serde::Serialize; // The faked schema since diesel doesn't do views table! { @@ -83,9 +83,7 @@ table! { } } -#[derive( - Queryable, Identifiable, PartialEq, Debug, Serialize, QueryableByName, Clone, -)] +#[derive(Queryable, Identifiable, PartialEq, Debug, Serialize, QueryableByName, Clone)] #[table_name = "user_mention_fast_view"] pub struct UserMentionView { pub id: i32, diff --git a/lemmy_db/src/user_view.rs b/lemmy_db/src/user_view.rs index a4f6f47ae..b0c28d31c 100644 --- a/lemmy_db/src/user_view.rs +++ b/lemmy_db/src/user_view.rs @@ -1,7 +1,7 @@ use super::user_view::user_fast::BoxedQuery; use crate::{fuzzy_search, limit_and_offset, MaybeOptional, SortType}; use diesel::{dsl::*, pg::Pg, result::Error, *}; -use serde::{Serialize}; +use serde::Serialize; table! { user_view (id) { @@ -51,9 +51,7 @@ table! { } } -#[derive( - Queryable, Identifiable, PartialEq, Debug, Serialize, QueryableByName, Clone, -)] +#[derive(Queryable, Identifiable, PartialEq, Debug, Serialize, QueryableByName, Clone)] #[table_name = "user_fast"] pub struct UserView { pub id: i32, diff --git a/lemmy_utils/src/lib.rs b/lemmy_utils/src/lib.rs index d28218282..0ce38e3dd 100644 --- a/lemmy_utils/src/lib.rs +++ b/lemmy_utils/src/lib.rs @@ -24,9 +24,7 @@ use lettre::{ extension::ClientId, ConnectionReuseParameters, }, - ClientSecurity, - SmtpClient, - Transport, + ClientSecurity, SmtpClient, Transport, }; use lettre_email::Email; use openssl::{pkey::PKey, rsa::Rsa}; @@ -223,14 +221,8 @@ pub fn is_valid_post_title(title: &str) -> bool { #[cfg(test)] mod tests { use crate::{ - is_valid_community_name, - is_valid_post_title, - is_valid_preferred_username, - is_valid_username, - remove_slurs, - scrape_text_for_mentions, - slur_check, - slurs_vec_to_str, + is_valid_community_name, is_valid_post_title, is_valid_preferred_username, is_valid_username, + remove_slurs, scrape_text_for_mentions, slur_check, slurs_vec_to_str, }; #[test] diff --git a/src/api/comment.rs b/src/api/comment.rs index e7b4080eb..9d314fb4e 100644 --- a/src/api/comment.rs +++ b/src/api/comment.rs @@ -1,10 +1,6 @@ use crate::{ api::{ - check_community_ban, - get_post, - get_user_from_jwt, - get_user_from_jwt_opt, - is_mod_or_admin, + check_community_ban, get_post, get_user_from_jwt, get_user_from_jwt_opt, is_mod_or_admin, Perform, }, apub::{ApubLikeableType, ApubObjectType}, @@ -13,36 +9,17 @@ use crate::{ messages::{JoinCommunityRoom, SendComment}, UserOperation, }, - DbPool, - LemmyContext, + DbPool, LemmyContext, }; use actix_web::web::Data; use lemmy_api_structs::comment::*; use lemmy_db::{ - comment::*, - comment_view::*, - moderator::*, - post::*, - site_view::*, - user::*, - user_mention::*, - Crud, - Likeable, - ListingType, - Saveable, - SortType, + comment::*, comment_view::*, moderator::*, post::*, site_view::*, user::*, user_mention::*, Crud, + Likeable, ListingType, Saveable, SortType, }; use lemmy_utils::{ - make_apub_endpoint, - remove_slurs, - scrape_text_for_mentions, - send_email, - settings::Settings, - APIError, - ConnectionId, - EndpointType, - LemmyError, - MentionData, + make_apub_endpoint, remove_slurs, scrape_text_for_mentions, send_email, settings::Settings, + APIError, ConnectionId, EndpointType, LemmyError, MentionData, }; use log::error; use std::str::FromStr; diff --git a/src/api/community.rs b/src/api/community.rs index 6fb67b330..44148b194 100644 --- a/src/api/community.rs +++ b/src/api/community.rs @@ -1,12 +1,7 @@ use crate::{ api::{ - check_slurs, - check_slurs_opt, - get_user_from_jwt, - get_user_from_jwt_opt, - is_admin, - is_mod_or_admin, - Perform, + check_slurs, check_slurs_opt, get_user_from_jwt, get_user_from_jwt_opt, is_admin, + is_mod_or_admin, Perform, }, apub::ActorType, blocking, @@ -20,32 +15,13 @@ use actix_web::web::Data; use anyhow::Context; use lemmy_api_structs::community::*; use lemmy_db::{ - comment::Comment, - comment_view::CommentQueryBuilder, - community::*, - community_view::*, - diesel_option_overwrite, - moderator::*, - naive_now, - post::Post, - site::*, - user_view::*, - Bannable, - Crud, - Followable, - Joinable, - SortType, + comment::Comment, comment_view::CommentQueryBuilder, community::*, community_view::*, + diesel_option_overwrite, moderator::*, naive_now, post::Post, site::*, user_view::*, Bannable, + Crud, Followable, Joinable, SortType, }; use lemmy_utils::{ - generate_actor_keypair, - is_valid_community_name, - location_info, - make_apub_endpoint, - naive_from_unix, - APIError, - ConnectionId, - EndpointType, - LemmyError, + generate_actor_keypair, is_valid_community_name, location_info, make_apub_endpoint, + naive_from_unix, APIError, ConnectionId, EndpointType, LemmyError, }; use std::str::FromStr; diff --git a/src/api/mod.rs b/src/api/mod.rs index a1b8c188d..e8b86db6c 100644 --- a/src/api/mod.rs +++ b/src/api/mod.rs @@ -1,11 +1,7 @@ use crate::{api::claims::Claims, blocking, DbPool, LemmyContext}; use actix_web::web::Data; use lemmy_db::{ - community::Community, - community_view::CommunityUserBanView, - post::Post, - user::User_, - Crud, + community::Community, community_view::CommunityUserBanView, post::Post, user::User_, Crud, }; use lemmy_utils::{slur_check, slurs_vec_to_str, APIError, ConnectionId, LemmyError}; diff --git a/src/api/post.rs b/src/api/post.rs index 9e1e97d51..a74737f4f 100644 --- a/src/api/post.rs +++ b/src/api/post.rs @@ -1,16 +1,10 @@ use crate::{ api::{ - check_community_ban, - check_slurs, - check_slurs_opt, - get_user_from_jwt, - get_user_from_jwt_opt, - is_mod_or_admin, - Perform, + check_community_ban, check_slurs, check_slurs_opt, get_user_from_jwt, get_user_from_jwt_opt, + is_mod_or_admin, Perform, }, apub::{ApubLikeableType, ApubObjectType}, - blocking, - fetch_iframely_and_pictrs_data, + blocking, fetch_iframely_and_pictrs_data, websocket::{ messages::{GetPostUsersOnline, JoinCommunityRoom, JoinPostRoom, SendPost}, UserOperation, @@ -20,26 +14,11 @@ use crate::{ use actix_web::web::Data; use lemmy_api_structs::post::*; use lemmy_db::{ - comment_view::*, - community_view::*, - moderator::*, - naive_now, - post::*, - post_view::*, - site_view::*, - Crud, - Likeable, - ListingType, - Saveable, - SortType, + comment_view::*, community_view::*, moderator::*, naive_now, post::*, post_view::*, site_view::*, + Crud, Likeable, ListingType, Saveable, SortType, }; use lemmy_utils::{ - is_valid_post_title, - make_apub_endpoint, - APIError, - ConnectionId, - EndpointType, - LemmyError, + is_valid_post_title, make_apub_endpoint, APIError, ConnectionId, EndpointType, LemmyError, }; use std::str::FromStr; use url::Url; diff --git a/src/api/site.rs b/src/api/site.rs index 8bcc4b77a..28192ae21 100644 --- a/src/api/site.rs +++ b/src/api/site.rs @@ -1,15 +1,9 @@ use crate::{ api::{ - check_slurs, - check_slurs_opt, - get_user_from_jwt, - get_user_from_jwt_opt, - is_admin, - Perform, + check_slurs, check_slurs_opt, get_user_from_jwt, get_user_from_jwt_opt, is_admin, Perform, }, apub::fetcher::search_by_apub_id, - blocking, - version, + blocking, version, websocket::{ messages::{GetUsersOnline, SendAllMessage}, UserOperation, @@ -20,20 +14,9 @@ use actix_web::web::Data; use anyhow::Context; use lemmy_api_structs::{site::*, user::Register}; use lemmy_db::{ - category::*, - comment_view::*, - community_view::*, - diesel_option_overwrite, - moderator::*, - moderator_views::*, - naive_now, - post_view::*, - site::*, - site_view::*, - user_view::*, - Crud, - SearchType, - SortType, + category::*, comment_view::*, community_view::*, diesel_option_overwrite, moderator::*, + moderator_views::*, naive_now, post_view::*, site::*, site_view::*, user_view::*, Crud, + SearchType, SortType, }; use lemmy_utils::{location_info, settings::Settings, APIError, ConnectionId, LemmyError}; use log::{debug, info}; diff --git a/src/api/user.rs b/src/api/user.rs index 1a71b3aa0..71e6c8626 100644 --- a/src/api/user.rs +++ b/src/api/user.rs @@ -1,8 +1,7 @@ use crate::{ api::{check_slurs, claims::Claims, get_user_from_jwt, get_user_from_jwt_opt, is_admin, Perform}, apub::ApubObjectType, - blocking, - captcha_espeak_wav_base64, + blocking, captcha_espeak_wav_base64, websocket::{ messages::{CaptchaItem, CheckCaptcha, JoinUserRoom, SendAllMessage, SendUserRoomMessage}, UserOperation, @@ -16,45 +15,15 @@ use captcha::{gen, Difficulty}; use chrono::Duration; use lemmy_api_structs::user::*; use lemmy_db::{ - comment::*, - comment_view::*, - community::*, - community_view::*, - diesel_option_overwrite, - moderator::*, - naive_now, - password_reset_request::*, - post::*, - post_view::*, - private_message::*, - private_message_view::*, - site::*, - site_view::*, - user::*, - user_mention::*, - user_mention_view::*, - user_view::*, - Crud, - Followable, - Joinable, - ListingType, - SortType, + comment::*, comment_view::*, community::*, community_view::*, diesel_option_overwrite, + moderator::*, naive_now, password_reset_request::*, post::*, post_view::*, private_message::*, + private_message_view::*, site::*, site_view::*, user::*, user_mention::*, user_mention_view::*, + user_view::*, Crud, Followable, Joinable, ListingType, SortType, }; use lemmy_utils::{ - generate_actor_keypair, - generate_random_string, - is_valid_preferred_username, - is_valid_username, - location_info, - make_apub_endpoint, - naive_from_unix, - remove_slurs, - send_email, - settings::Settings, - APIError, - ConnectionId, - EndpointType, - LemmyError, + generate_actor_keypair, generate_random_string, is_valid_preferred_username, is_valid_username, + location_info, make_apub_endpoint, naive_from_unix, remove_slurs, send_email, settings::Settings, + APIError, ConnectionId, EndpointType, LemmyError, }; use log::error; use std::str::FromStr; diff --git a/src/apub/activity_queue.rs b/src/apub/activity_queue.rs index 008846bf3..e3461736d 100644 --- a/src/apub/activity_queue.rs +++ b/src/apub/activity_queue.rs @@ -6,13 +6,7 @@ use activitystreams::{ use anyhow::{anyhow, Context, Error}; use awc::Client; use background_jobs::{ - create_server, - memory_storage::Storage, - ActixJob, - Backoff, - MaxRetries, - QueueHandle, - WorkerConfig, + create_server, memory_storage::Storage, ActixJob, Backoff, MaxRetries, QueueHandle, WorkerConfig, }; use lemmy_utils::{location_info, settings::Settings, LemmyError}; use log::warn; diff --git a/src/apub/comment.rs b/src/apub/comment.rs index 8c416369f..1bb928c69 100644 --- a/src/apub/comment.rs +++ b/src/apub/comment.rs @@ -1,36 +1,19 @@ use crate::{ apub::{ activities::{generate_activity_id, send_activity_to_community}, - check_actor_domain, - create_apub_response, - create_apub_tombstone_response, - create_tombstone, + check_actor_domain, create_apub_response, create_apub_tombstone_response, create_tombstone, fetch_webfinger_url, fetcher::{ - get_or_fetch_and_insert_comment, - get_or_fetch_and_insert_post, - get_or_fetch_and_upsert_user, + get_or_fetch_and_insert_comment, get_or_fetch_and_insert_post, get_or_fetch_and_upsert_user, }, - ActorType, - ApubLikeableType, - ApubObjectType, - FromApub, - ToApub, + ActorType, ApubLikeableType, ApubObjectType, FromApub, ToApub, }, - blocking, - DbPool, - LemmyContext, + blocking, DbPool, LemmyContext, }; use activitystreams::{ activity::{ kind::{CreateType, DeleteType, DislikeType, LikeType, RemoveType, UndoType, UpdateType}, - Create, - Delete, - Dislike, - Like, - Remove, - Undo, - Update, + Create, Delete, Dislike, Like, Remove, Undo, Update, }, base::AnyBase, link::Mention, @@ -49,12 +32,7 @@ use lemmy_db::{ Crud, }; use lemmy_utils::{ - convert_datetime, - location_info, - remove_slurs, - scrape_text_for_mentions, - LemmyError, - MentionData, + convert_datetime, location_info, remove_slurs, scrape_text_for_mentions, LemmyError, MentionData, }; use log::debug; use serde::Deserialize; diff --git a/src/apub/community.rs b/src/apub/community.rs index 8d9b4dc1c..c166ce33e 100644 --- a/src/apub/community.rs +++ b/src/apub/community.rs @@ -3,31 +3,17 @@ use crate::{ apub::{ activities::generate_activity_id, activity_queue::send_activity, - check_actor_domain, - create_apub_response, - create_apub_tombstone_response, - create_tombstone, + check_actor_domain, create_apub_response, create_apub_tombstone_response, create_tombstone, extensions::group_extensions::GroupExtension, fetcher::{get_or_fetch_and_upsert_actor, get_or_fetch_and_upsert_user}, - insert_activity, - ActorType, - FromApub, - GroupExt, - ToApub, + insert_activity, ActorType, FromApub, GroupExt, ToApub, }, - blocking, - DbPool, - LemmyContext, + blocking, DbPool, LemmyContext, }; use activitystreams::{ activity::{ kind::{AcceptType, AnnounceType, DeleteType, LikeType, RemoveType, UndoType}, - Accept, - Announce, - Delete, - Follow, - Remove, - Undo, + Accept, Announce, Delete, Follow, Remove, Undo, }, actor::{kind::GroupType, ApActor, Endpoints, Group}, base::{AnyBase, BaseExt}, diff --git a/src/apub/fetcher.rs b/src/apub/fetcher.rs index d45165777..476d64c08 100644 --- a/src/apub/fetcher.rs +++ b/src/apub/fetcher.rs @@ -1,11 +1,6 @@ use crate::{ apub::{ - check_is_apub_id_valid, - ActorType, - FromApub, - GroupExt, - PageExt, - PersonExt, + check_is_apub_id_valid, ActorType, FromApub, GroupExt, PageExt, PersonExt, APUB_JSON_CONTENT_TYPE, }, blocking, @@ -27,9 +22,7 @@ use lemmy_db::{ post_view::PostView, user::{UserForm, User_}, user_view::UserView, - Crud, - Joinable, - SearchType, + Crud, Joinable, SearchType, }; use lemmy_utils::{get_apub_protocol_string, location_info, LemmyError}; use log::debug; diff --git a/src/apub/inbox/activities/announce.rs b/src/apub/inbox/activities/announce.rs index 47607a05d..f75826b72 100644 --- a/src/apub/inbox/activities/announce.rs +++ b/src/apub/inbox/activities/announce.rs @@ -1,13 +1,8 @@ use crate::{ apub::inbox::{ activities::{ - create::receive_create, - delete::receive_delete, - dislike::receive_dislike, - like::receive_like, - remove::receive_remove, - undo::receive_undo, - update::receive_update, + create::receive_create, delete::receive_delete, dislike::receive_dislike, like::receive_like, + remove::receive_remove, undo::receive_undo, update::receive_update, }, shared_inbox::{get_community_id_from_activity, receive_unhandled_activity}, }, diff --git a/src/apub/inbox/activities/create.rs b/src/apub/inbox/activities/create.rs index a39152047..a129681f7 100644 --- a/src/apub/inbox/activities/create.rs +++ b/src/apub/inbox/activities/create.rs @@ -2,13 +2,9 @@ use crate::{ api::comment::send_local_notifs, apub::{ inbox::shared_inbox::{ - announce_if_community_is_local, - get_user_from_activity, - receive_unhandled_activity, + announce_if_community_is_local, get_user_from_activity, receive_unhandled_activity, }, - ActorType, - FromApub, - PageExt, + ActorType, FromApub, PageExt, }, blocking, websocket::{ diff --git a/src/apub/inbox/activities/delete.rs b/src/apub/inbox/activities/delete.rs index 70bf37616..a20f57e43 100644 --- a/src/apub/inbox/activities/delete.rs +++ b/src/apub/inbox/activities/delete.rs @@ -2,14 +2,9 @@ use crate::{ apub::{ fetcher::{get_or_fetch_and_insert_comment, get_or_fetch_and_insert_post}, inbox::shared_inbox::{ - announce_if_community_is_local, - get_user_from_activity, - receive_unhandled_activity, + announce_if_community_is_local, get_user_from_activity, receive_unhandled_activity, }, - ActorType, - FromApub, - GroupExt, - PageExt, + ActorType, FromApub, GroupExt, PageExt, }, blocking, websocket::{ @@ -22,9 +17,7 @@ use activitystreams::{activity::Delete, base::AnyBase, object::Note, prelude::*} use actix_web::HttpResponse; use anyhow::Context; use lemmy_api_structs::{ - comment::CommentResponse, - community::CommunityResponse, - post::PostResponse, + comment::CommentResponse, community::CommunityResponse, post::PostResponse, }; use lemmy_db::{ comment::{Comment, CommentForm}, diff --git a/src/apub/inbox/activities/dislike.rs b/src/apub/inbox/activities/dislike.rs index 599389b18..a0a2bc19a 100644 --- a/src/apub/inbox/activities/dislike.rs +++ b/src/apub/inbox/activities/dislike.rs @@ -2,12 +2,9 @@ use crate::{ apub::{ fetcher::{get_or_fetch_and_insert_comment, get_or_fetch_and_insert_post}, inbox::shared_inbox::{ - announce_if_community_is_local, - get_user_from_activity, - receive_unhandled_activity, + announce_if_community_is_local, get_user_from_activity, receive_unhandled_activity, }, - FromApub, - PageExt, + FromApub, PageExt, }, blocking, websocket::{ diff --git a/src/apub/inbox/activities/like.rs b/src/apub/inbox/activities/like.rs index 2cb95521e..08eddd5ff 100644 --- a/src/apub/inbox/activities/like.rs +++ b/src/apub/inbox/activities/like.rs @@ -2,12 +2,9 @@ use crate::{ apub::{ fetcher::{get_or_fetch_and_insert_comment, get_or_fetch_and_insert_post}, inbox::shared_inbox::{ - announce_if_community_is_local, - get_user_from_activity, - receive_unhandled_activity, + announce_if_community_is_local, get_user_from_activity, receive_unhandled_activity, }, - FromApub, - PageExt, + FromApub, PageExt, }, blocking, websocket::{ diff --git a/src/apub/inbox/activities/remove.rs b/src/apub/inbox/activities/remove.rs index 846842d4e..9465b86e8 100644 --- a/src/apub/inbox/activities/remove.rs +++ b/src/apub/inbox/activities/remove.rs @@ -2,15 +2,10 @@ use crate::{ apub::{ fetcher::{get_or_fetch_and_insert_comment, get_or_fetch_and_insert_post}, inbox::shared_inbox::{ - announce_if_community_is_local, - get_community_id_from_activity, - get_user_from_activity, + announce_if_community_is_local, get_community_id_from_activity, get_user_from_activity, receive_unhandled_activity, }, - ActorType, - FromApub, - GroupExt, - PageExt, + ActorType, FromApub, GroupExt, PageExt, }, blocking, websocket::{ @@ -23,9 +18,7 @@ use activitystreams::{activity::Remove, base::AnyBase, object::Note, prelude::*} use actix_web::HttpResponse; use anyhow::{anyhow, Context}; use lemmy_api_structs::{ - comment::CommentResponse, - community::CommunityResponse, - post::PostResponse, + comment::CommentResponse, community::CommunityResponse, post::PostResponse, }; use lemmy_db::{ comment::{Comment, CommentForm}, diff --git a/src/apub/inbox/activities/undo.rs b/src/apub/inbox/activities/undo.rs index 0b695d32e..78139076b 100644 --- a/src/apub/inbox/activities/undo.rs +++ b/src/apub/inbox/activities/undo.rs @@ -2,14 +2,9 @@ use crate::{ apub::{ fetcher::{get_or_fetch_and_insert_comment, get_or_fetch_and_insert_post}, inbox::shared_inbox::{ - announce_if_community_is_local, - get_user_from_activity, - receive_unhandled_activity, + announce_if_community_is_local, get_user_from_activity, receive_unhandled_activity, }, - ActorType, - FromApub, - GroupExt, - PageExt, + ActorType, FromApub, GroupExt, PageExt, }, blocking, websocket::{ @@ -27,9 +22,7 @@ use activitystreams::{ use actix_web::HttpResponse; use anyhow::{anyhow, Context}; use lemmy_api_structs::{ - comment::CommentResponse, - community::CommunityResponse, - post::PostResponse, + comment::CommentResponse, community::CommunityResponse, post::PostResponse, }; use lemmy_db::{ comment::{Comment, CommentForm, CommentLike}, @@ -39,8 +32,7 @@ use lemmy_db::{ naive_now, post::{Post, PostForm, PostLike}, post_view::PostView, - Crud, - Likeable, + Crud, Likeable, }; use lemmy_utils::{location_info, LemmyError}; diff --git a/src/apub/inbox/activities/update.rs b/src/apub/inbox/activities/update.rs index eb1b67f1d..335ca1d9f 100644 --- a/src/apub/inbox/activities/update.rs +++ b/src/apub/inbox/activities/update.rs @@ -3,13 +3,9 @@ use crate::{ apub::{ fetcher::{get_or_fetch_and_insert_comment, get_or_fetch_and_insert_post}, inbox::shared_inbox::{ - announce_if_community_is_local, - get_user_from_activity, - receive_unhandled_activity, + announce_if_community_is_local, get_user_from_activity, receive_unhandled_activity, }, - ActorType, - FromApub, - PageExt, + ActorType, FromApub, PageExt, }, blocking, websocket::{ diff --git a/src/apub/inbox/community_inbox.rs b/src/apub/inbox/community_inbox.rs index 0631f9391..d051497ed 100644 --- a/src/apub/inbox/community_inbox.rs +++ b/src/apub/inbox/community_inbox.rs @@ -1,13 +1,9 @@ use crate::{ apub::{ - check_is_apub_id_valid, - extensions::signatures::verify, - fetcher::get_or_fetch_and_upsert_user, - insert_activity, - ActorType, + check_is_apub_id_valid, extensions::signatures::verify, fetcher::get_or_fetch_and_upsert_user, + insert_activity, ActorType, }, - blocking, - LemmyContext, + blocking, LemmyContext, }; use activitystreams::{ activity::{ActorAndObject, Follow, Undo}, diff --git a/src/apub/inbox/shared_inbox.rs b/src/apub/inbox/shared_inbox.rs index da7951082..9c1aec50a 100644 --- a/src/apub/inbox/shared_inbox.rs +++ b/src/apub/inbox/shared_inbox.rs @@ -4,18 +4,12 @@ use crate::{ community::do_announce, extensions::signatures::verify, fetcher::{ - get_or_fetch_and_upsert_actor, - get_or_fetch_and_upsert_community, + get_or_fetch_and_upsert_actor, get_or_fetch_and_upsert_community, get_or_fetch_and_upsert_user, }, inbox::activities::{ - announce::receive_announce, - create::receive_create, - delete::receive_delete, - dislike::receive_dislike, - like::receive_like, - remove::receive_remove, - undo::receive_undo, + announce::receive_announce, create::receive_create, delete::receive_delete, + dislike::receive_dislike, like::receive_like, remove::receive_remove, undo::receive_undo, update::receive_update, }, insert_activity, diff --git a/src/apub/inbox/user_inbox.rs b/src/apub/inbox/user_inbox.rs index 7ea95833e..a8a4edfb0 100644 --- a/src/apub/inbox/user_inbox.rs +++ b/src/apub/inbox/user_inbox.rs @@ -3,8 +3,7 @@ use crate::{ check_is_apub_id_valid, extensions::signatures::verify, fetcher::{get_or_fetch_and_upsert_actor, get_or_fetch_and_upsert_community}, - insert_activity, - FromApub, + insert_activity, FromApub, }, blocking, websocket::{messages::SendUserRoomMessage, UserOperation}, @@ -25,8 +24,7 @@ use lemmy_db::{ private_message::{PrivateMessage, PrivateMessageForm}, private_message_view::PrivateMessageView, user::User_, - Crud, - Followable, + Crud, Followable, }; use lemmy_utils::{location_info, LemmyError}; use log::debug; diff --git a/src/apub/mod.rs b/src/apub/mod.rs index b3b161c7d..d2c6f61e7 100644 --- a/src/apub/mod.rs +++ b/src/apub/mod.rs @@ -18,8 +18,7 @@ use crate::{ blocking, request::{retry, RecvError}, routes::webfinger::WebFingerResponse, - DbPool, - LemmyContext, + DbPool, LemmyContext, }; use activitystreams::{ activity::Follow, @@ -35,11 +34,7 @@ use anyhow::{anyhow, Context}; use chrono::NaiveDateTime; use lemmy_db::{activity::do_insert_activity, user::User_}; use lemmy_utils::{ - convert_datetime, - get_apub_protocol_string, - location_info, - settings::Settings, - LemmyError, + convert_datetime, get_apub_protocol_string, location_info, settings::Settings, LemmyError, MentionData, }; use log::debug; diff --git a/src/apub/post.rs b/src/apub/post.rs index a54b8f6a3..baaf8bd9a 100644 --- a/src/apub/post.rs +++ b/src/apub/post.rs @@ -2,33 +2,17 @@ use crate::{ api::check_slurs, apub::{ activities::{generate_activity_id, send_activity_to_community}, - check_actor_domain, - create_apub_response, - create_apub_tombstone_response, - create_tombstone, + check_actor_domain, create_apub_response, create_apub_tombstone_response, create_tombstone, extensions::page_extension::PageExtension, fetcher::{get_or_fetch_and_upsert_community, get_or_fetch_and_upsert_user}, - ActorType, - ApubLikeableType, - ApubObjectType, - FromApub, - PageExt, - ToApub, + ActorType, ApubLikeableType, ApubObjectType, FromApub, PageExt, ToApub, }, - blocking, - DbPool, - LemmyContext, + blocking, DbPool, LemmyContext, }; use activitystreams::{ activity::{ kind::{CreateType, DeleteType, DislikeType, LikeType, RemoveType, UndoType, UpdateType}, - Create, - Delete, - Dislike, - Like, - Remove, - Undo, - Update, + Create, Delete, Dislike, Like, Remove, Undo, Update, }, object::{kind::PageType, Image, Object, Page, Tombstone}, prelude::*, diff --git a/src/apub/private_message.rs b/src/apub/private_message.rs index 5563aef36..0fff08dc0 100644 --- a/src/apub/private_message.rs +++ b/src/apub/private_message.rs @@ -1,28 +1,15 @@ use crate::{ apub::{ - activities::generate_activity_id, - activity_queue::send_activity, - check_actor_domain, - check_is_apub_id_valid, - create_tombstone, - fetcher::get_or_fetch_and_upsert_user, - insert_activity, - ActorType, - ApubObjectType, - FromApub, - ToApub, + activities::generate_activity_id, activity_queue::send_activity, check_actor_domain, + check_is_apub_id_valid, create_tombstone, fetcher::get_or_fetch_and_upsert_user, + insert_activity, ActorType, ApubObjectType, FromApub, ToApub, }, - blocking, - DbPool, - LemmyContext, + blocking, DbPool, LemmyContext, }; use activitystreams::{ activity::{ kind::{CreateType, DeleteType, UndoType, UpdateType}, - Create, - Delete, - Undo, - Update, + Create, Delete, Undo, Update, }, object::{kind::NoteType, Note, Tombstone}, prelude::*, diff --git a/src/apub/user.rs b/src/apub/user.rs index 5522a3413..8b1acc4a5 100644 --- a/src/apub/user.rs +++ b/src/apub/user.rs @@ -1,26 +1,16 @@ use crate::{ api::{check_slurs, check_slurs_opt}, apub::{ - activities::generate_activity_id, - activity_queue::send_activity, - check_actor_domain, - create_apub_response, - fetcher::get_or_fetch_and_upsert_actor, - insert_activity, - ActorType, - FromApub, - PersonExt, - ToApub, + activities::generate_activity_id, activity_queue::send_activity, check_actor_domain, + create_apub_response, fetcher::get_or_fetch_and_upsert_actor, insert_activity, ActorType, + FromApub, PersonExt, ToApub, }, - blocking, - DbPool, - LemmyContext, + blocking, DbPool, LemmyContext, }; use activitystreams::{ activity::{ kind::{FollowType, UndoType}, - Follow, - Undo, + Follow, Undo, }, actor::{ApActor, Endpoints, Person}, object::{Image, Tombstone}, diff --git a/src/code_migrations.rs b/src/code_migrations.rs index e59aa88c7..40ae17147 100644 --- a/src/code_migrations.rs +++ b/src/code_migrations.rs @@ -13,12 +13,8 @@ use lemmy_db::{ Crud, }; use lemmy_utils::{ - generate_actor_keypair, - get_apub_protocol_string, - make_apub_endpoint, - settings::Settings, - EndpointType, - LemmyError, + generate_actor_keypair, get_apub_protocol_string, make_apub_endpoint, settings::Settings, + EndpointType, LemmyError, }; use log::info; diff --git a/src/main.rs b/src/main.rs index 52609da79..3289f8c4f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -19,12 +19,8 @@ use lazy_static::lazy_static; use lemmy_db::get_database_url_from_env; use lemmy_rate_limit::{rate_limiter::RateLimiter, RateLimit}; use lemmy_server::{ - apub::activity_queue::create_activity_queue, - blocking, - code_migrations::run_advanced_migrations, - routes::*, - websocket::chat_server::ChatServer, - LemmyContext, + apub::activity_queue::create_activity_queue, blocking, code_migrations::run_advanced_migrations, + routes::*, websocket::chat_server::ChatServer, LemmyContext, }; use lemmy_utils::{settings::Settings, LemmyError, CACHE_CONTROL_REGEX}; use reqwest::Client; @@ -102,10 +98,7 @@ async fn main() -> Result<(), LemmyError> { .configure(|cfg| images::config(cfg, &rate_limiter)) .configure(nodeinfo::config) .configure(webfinger::config) - .service(actix_files::Files::new( - "/docs", - "/documentation", - )) + .service(actix_files::Files::new("/docs", "/documentation")) }) .bind((settings.bind, settings.port))? .run() diff --git a/src/routes/feeds.rs b/src/routes/feeds.rs index 9bfe4cb6f..20251876a 100644 --- a/src/routes/feeds.rs +++ b/src/routes/feeds.rs @@ -10,8 +10,7 @@ use lemmy_db::{ site_view::SiteView, user::User_, user_mention_view::{UserMentionQueryBuilder, UserMentionView}, - ListingType, - SortType, + ListingType, SortType, }; use lemmy_utils::{markdown_to_html, settings::Settings, LemmyError}; use rss::{CategoryBuilder, ChannelBuilder, GuidBuilder, Item, ItemBuilder}; diff --git a/src/routes/webfinger.rs b/src/routes/webfinger.rs index 22861434c..4cbec5ca2 100644 --- a/src/routes/webfinger.rs +++ b/src/routes/webfinger.rs @@ -3,10 +3,7 @@ use actix_web::{error::ErrorBadRequest, web::Query, *}; use anyhow::anyhow; use lemmy_db::{community::Community, user::User_}; use lemmy_utils::{ - settings::Settings, - LemmyError, - WEBFINGER_COMMUNITY_REGEX, - WEBFINGER_USER_REGEX, + settings::Settings, LemmyError, WEBFINGER_COMMUNITY_REGEX, WEBFINGER_USER_REGEX, }; use serde::{Deserialize, Serialize}; diff --git a/src/websocket/chat_server.rs b/src/websocket/chat_server.rs index b8066eece..43e4e5b69 100644 --- a/src/websocket/chat_server.rs +++ b/src/websocket/chat_server.rs @@ -16,14 +16,7 @@ use diesel::{ use lemmy_api_structs::{comment::*, community::*, post::*, site::*, user::*}; use lemmy_rate_limit::RateLimit; use lemmy_utils::{ - location_info, - APIError, - CommunityId, - ConnectionId, - IPAddr, - LemmyError, - PostId, - UserId, + location_info, APIError, CommunityId, ConnectionId, IPAddr, LemmyError, PostId, UserId, }; use rand::rngs::ThreadRng; use reqwest::Client;