From: Dessalines Date: Wed, 2 Nov 2022 19:18:22 +0000 (-0400) Subject: Group imports dess (#2526) X-Git-Url: http://these/git/%7B%60%24%7BwebArchiveUrl%7D/%22%7B%7D/readmes/%7B%7D/%22%7Burl%7D/%7Biframely.url%7D?a=commitdiff_plain;h=cb753b045fe90294051cc7a09855418f917dcc34;p=lemmy.git Group imports dess (#2526) * Group imports with rustfmt * Running cargo fmt again. Co-authored-by: Felix Ableitner --- diff --git a/.rustfmt.toml b/.rustfmt.toml index 6bf5e0ed..c539ff0b 100644 --- a/.rustfmt.toml +++ b/.rustfmt.toml @@ -2,4 +2,4 @@ tab_spaces = 2 edition="2021" imports_layout="HorizontalVertical" imports_granularity="Crate" -reorder_imports=true +group_imports="One" \ No newline at end of file diff --git a/crates/api_crud/src/comment/update.rs b/crates/api_crud/src/comment/update.rs index f9a18fb3..9678765e 100644 --- a/crates/api_crud/src/comment/update.rs +++ b/crates/api_crud/src/comment/update.rs @@ -1,3 +1,4 @@ +use crate::PerformCrud; use actix_web::web::Data; use lemmy_api_common::{ comment::{CommentResponse, EditComment}, @@ -35,8 +36,6 @@ use lemmy_websocket::{ UserOperationCrud, }; -use crate::PerformCrud; - #[async_trait::async_trait(?Send)] impl PerformCrud for EditComment { type Response = CommentResponse; diff --git a/crates/apub/src/activities/block/undo_block_user.rs b/crates/apub/src/activities/block/undo_block_user.rs index 6de1d3a1..cd9784f3 100644 --- a/crates/apub/src/activities/block/undo_block_user.rs +++ b/crates/apub/src/activities/block/undo_block_user.rs @@ -1,3 +1,17 @@ +use crate::{ + activities::{ + block::{generate_cc, SiteOrCommunity}, + community::{announce::GetCommunity, send_activity_in_community}, + generate_activity_id, + send_lemmy_activity, + verify_is_public, + }, + activity_lists::AnnouncableActivities, + local_instance, + objects::{community::ApubCommunity, instance::remote_instance_inboxes, person::ApubPerson}, + protocol::activities::block::{block_user::BlockUser, undo_block_user::UndoBlockUser}, + ActorType, +}; use activitypub_federation::{ core::object_id::ObjectId, data::Data, @@ -18,21 +32,6 @@ use lemmy_utils::error::LemmyError; use lemmy_websocket::LemmyContext; use url::Url; -use crate::{ - activities::{ - block::{generate_cc, SiteOrCommunity}, - community::{announce::GetCommunity, send_activity_in_community}, - generate_activity_id, - send_lemmy_activity, - verify_is_public, - }, - activity_lists::AnnouncableActivities, - local_instance, - objects::{community::ApubCommunity, instance::remote_instance_inboxes, person::ApubPerson}, - protocol::activities::block::{block_user::BlockUser, undo_block_user::UndoBlockUser}, - ActorType, -}; - impl UndoBlockUser { #[tracing::instrument(skip_all)] pub async fn send( diff --git a/crates/apub/src/activities/voting/mod.rs b/crates/apub/src/activities/voting/mod.rs index 4896b4c6..6744e1c5 100644 --- a/crates/apub/src/activities/voting/mod.rs +++ b/crates/apub/src/activities/voting/mod.rs @@ -1,3 +1,7 @@ +use crate::{ + objects::{comment::ApubComment, person::ApubPerson, post::ApubPost}, + protocol::activities::voting::vote::VoteType, +}; use lemmy_api_common::utils::blocking; use lemmy_db_schema::{ source::{ @@ -13,11 +17,6 @@ use lemmy_websocket::{ UserOperation, }; -use crate::{ - objects::{comment::ApubComment, person::ApubPerson, post::ApubPost}, - protocol::activities::voting::vote::VoteType, -}; - pub mod undo_vote; pub mod vote; diff --git a/crates/apub/src/collections/mod.rs b/crates/apub/src/collections/mod.rs index a2e77d1b..e2a274a0 100644 --- a/crates/apub/src/collections/mod.rs +++ b/crates/apub/src/collections/mod.rs @@ -1,6 +1,5 @@ -use lemmy_websocket::LemmyContext; - use crate::objects::community::ApubCommunity; +use lemmy_websocket::LemmyContext; pub(crate) mod community_moderators; pub(crate) mod community_outbox; diff --git a/crates/db_schema/src/aggregates/structs.rs b/crates/db_schema/src/aggregates/structs.rs index ab87f458..0cc4dd05 100644 --- a/crates/db_schema/src/aggregates/structs.rs +++ b/crates/db_schema/src/aggregates/structs.rs @@ -1,6 +1,4 @@ use crate::newtypes::{CommentId, CommunityId, PersonId, PostId}; -use serde::{Deserialize, Serialize}; - #[cfg(feature = "full")] use crate::schema::{ comment_aggregates, @@ -10,6 +8,7 @@ use crate::schema::{ post_aggregates, site_aggregates, }; +use serde::{Deserialize, Serialize}; #[derive(PartialEq, Eq, Debug, Serialize, Deserialize, Clone)] #[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable))] diff --git a/crates/db_schema/src/source/actor_language.rs b/crates/db_schema/src/source/actor_language.rs index 8831791e..6780be51 100644 --- a/crates/db_schema/src/source/actor_language.rs +++ b/crates/db_schema/src/source/actor_language.rs @@ -7,10 +7,9 @@ use crate::newtypes::{ SiteId, SiteLanguageId, }; -use serde::{Deserialize, Serialize}; - #[cfg(feature = "full")] use crate::schema::local_user_language; +use serde::{Deserialize, Serialize}; #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] #[cfg_attr(feature = "full", derive(Queryable, Identifiable))] diff --git a/crates/db_schema/src/source/comment.rs b/crates/db_schema/src/source/comment.rs index 5b7ab085..ed520f1d 100644 --- a/crates/db_schema/src/source/comment.rs +++ b/crates/db_schema/src/source/comment.rs @@ -1,11 +1,10 @@ use crate::newtypes::{CommentId, DbUrl, LanguageId, LtreeDef, PersonId, PostId}; +#[cfg(feature = "full")] +use crate::schema::{comment, comment_like, comment_saved}; use diesel_ltree::Ltree; use serde::{Deserialize, Serialize}; use typed_builder::TypedBuilder; -#[cfg(feature = "full")] -use crate::schema::{comment, comment_like, comment_saved}; - #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] #[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable))] #[cfg_attr(feature = "full", diesel(belongs_to(crate::source::post::Post)))] diff --git a/crates/db_schema/src/source/comment_reply.rs b/crates/db_schema/src/source/comment_reply.rs index 8b7fe51b..bcce607e 100644 --- a/crates/db_schema/src/source/comment_reply.rs +++ b/crates/db_schema/src/source/comment_reply.rs @@ -1,8 +1,7 @@ use crate::newtypes::{CommentId, CommentReplyId, PersonId}; -use serde::{Deserialize, Serialize}; - #[cfg(feature = "full")] use crate::schema::comment_reply; +use serde::{Deserialize, Serialize}; #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] #[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable))] diff --git a/crates/db_schema/src/source/comment_report.rs b/crates/db_schema/src/source/comment_report.rs index 6cc328d0..9b55259d 100644 --- a/crates/db_schema/src/source/comment_report.rs +++ b/crates/db_schema/src/source/comment_report.rs @@ -1,8 +1,7 @@ use crate::newtypes::{CommentId, CommentReportId, PersonId}; -use serde::{Deserialize, Serialize}; - #[cfg(feature = "full")] use crate::schema::comment_report; +use serde::{Deserialize, Serialize}; #[derive(PartialEq, Eq, Serialize, Deserialize, Debug, Clone)] #[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable))] diff --git a/crates/db_schema/src/source/community.rs b/crates/db_schema/src/source/community.rs index 6d988ae7..446d92a0 100644 --- a/crates/db_schema/src/source/community.rs +++ b/crates/db_schema/src/source/community.rs @@ -1,9 +1,8 @@ use crate::newtypes::{CommunityId, DbUrl, InstanceId, PersonId}; -use serde::{Deserialize, Serialize}; -use typed_builder::TypedBuilder; - #[cfg(feature = "full")] use crate::schema::{community, community_follower, community_moderator, community_person_ban}; +use serde::{Deserialize, Serialize}; +use typed_builder::TypedBuilder; #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] #[cfg_attr(feature = "full", derive(Queryable, Identifiable))] diff --git a/crates/db_schema/src/source/community_block.rs b/crates/db_schema/src/source/community_block.rs index 8011e9ee..3efdce4f 100644 --- a/crates/db_schema/src/source/community_block.rs +++ b/crates/db_schema/src/source/community_block.rs @@ -1,8 +1,7 @@ use crate::newtypes::{CommunityBlockId, CommunityId, PersonId}; -use serde::{Deserialize, Serialize}; - #[cfg(feature = "full")] use crate::schema::community_block; +use serde::{Deserialize, Serialize}; #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] #[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable))] diff --git a/crates/db_schema/src/source/email_verification.rs b/crates/db_schema/src/source/email_verification.rs index d541421f..0ee5b47d 100644 --- a/crates/db_schema/src/source/email_verification.rs +++ b/crates/db_schema/src/source/email_verification.rs @@ -1,5 +1,4 @@ use crate::newtypes::LocalUserId; - #[cfg(feature = "full")] use crate::schema::email_verification; diff --git a/crates/db_schema/src/source/federation_allowlist.rs b/crates/db_schema/src/source/federation_allowlist.rs index 5ca5927f..309e24e3 100644 --- a/crates/db_schema/src/source/federation_allowlist.rs +++ b/crates/db_schema/src/source/federation_allowlist.rs @@ -1,9 +1,8 @@ use crate::newtypes::InstanceId; -use serde::{Deserialize, Serialize}; -use std::fmt::Debug; - #[cfg(feature = "full")] use crate::schema::federation_allowlist; +use serde::{Deserialize, Serialize}; +use std::fmt::Debug; #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] #[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable))] diff --git a/crates/db_schema/src/source/federation_blocklist.rs b/crates/db_schema/src/source/federation_blocklist.rs index 70f7a085..2ee5ec0f 100644 --- a/crates/db_schema/src/source/federation_blocklist.rs +++ b/crates/db_schema/src/source/federation_blocklist.rs @@ -1,9 +1,8 @@ use crate::newtypes::InstanceId; -use serde::{Deserialize, Serialize}; -use std::fmt::Debug; - #[cfg(feature = "full")] use crate::schema::federation_blocklist; +use serde::{Deserialize, Serialize}; +use std::fmt::Debug; #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] #[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable))] diff --git a/crates/db_schema/src/source/instance.rs b/crates/db_schema/src/source/instance.rs index 0b86f9c6..d5813005 100644 --- a/crates/db_schema/src/source/instance.rs +++ b/crates/db_schema/src/source/instance.rs @@ -1,8 +1,7 @@ use crate::newtypes::InstanceId; -use std::fmt::Debug; - #[cfg(feature = "full")] use crate::schema::instance; +use std::fmt::Debug; #[derive(PartialEq, Eq, Debug)] #[cfg_attr(feature = "full", derive(Queryable, Identifiable))] diff --git a/crates/db_schema/src/source/language.rs b/crates/db_schema/src/source/language.rs index 3c52eb47..19dcf487 100644 --- a/crates/db_schema/src/source/language.rs +++ b/crates/db_schema/src/source/language.rs @@ -1,8 +1,7 @@ use crate::newtypes::LanguageId; -use serde::{Deserialize, Serialize}; - #[cfg(feature = "full")] use crate::schema::language; +use serde::{Deserialize, Serialize}; #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] #[cfg_attr(feature = "full", derive(Queryable, Identifiable))] diff --git a/crates/db_schema/src/source/local_site.rs b/crates/db_schema/src/source/local_site.rs index 443923a4..79cd3852 100644 --- a/crates/db_schema/src/source/local_site.rs +++ b/crates/db_schema/src/source/local_site.rs @@ -1,9 +1,8 @@ use crate::newtypes::{LocalSiteId, SiteId}; -use serde::{Deserialize, Serialize}; -use typed_builder::TypedBuilder; - #[cfg(feature = "full")] use crate::schema::local_site; +use serde::{Deserialize, Serialize}; +use typed_builder::TypedBuilder; #[derive(PartialEq, Eq, Debug, Clone, Serialize, Deserialize)] #[cfg_attr(feature = "full", derive(Queryable, Identifiable))] diff --git a/crates/db_schema/src/source/local_site_rate_limit.rs b/crates/db_schema/src/source/local_site_rate_limit.rs index bd890137..f37f3e2d 100644 --- a/crates/db_schema/src/source/local_site_rate_limit.rs +++ b/crates/db_schema/src/source/local_site_rate_limit.rs @@ -1,9 +1,8 @@ use crate::newtypes::LocalSiteId; -use serde::{Deserialize, Serialize}; -use typed_builder::TypedBuilder; - #[cfg(feature = "full")] use crate::schema::local_site_rate_limit; +use serde::{Deserialize, Serialize}; +use typed_builder::TypedBuilder; #[derive(PartialEq, Eq, Debug, Clone, Serialize, Deserialize)] #[cfg_attr(feature = "full", derive(Queryable, Identifiable))] diff --git a/crates/db_schema/src/source/local_user.rs b/crates/db_schema/src/source/local_user.rs index 04fb4b87..37a559bc 100644 --- a/crates/db_schema/src/source/local_user.rs +++ b/crates/db_schema/src/source/local_user.rs @@ -1,9 +1,8 @@ use crate::newtypes::{LocalUserId, PersonId}; -use serde::{Deserialize, Serialize}; -use typed_builder::TypedBuilder; - #[cfg(feature = "full")] use crate::schema::local_user; +use serde::{Deserialize, Serialize}; +use typed_builder::TypedBuilder; #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] #[cfg_attr(feature = "full", derive(Queryable, Identifiable))] diff --git a/crates/db_schema/src/source/moderator.rs b/crates/db_schema/src/source/moderator.rs index d234ed99..000e3486 100644 --- a/crates/db_schema/src/source/moderator.rs +++ b/crates/db_schema/src/source/moderator.rs @@ -1,6 +1,4 @@ use crate::newtypes::{CommentId, CommunityId, PersonId, PostId}; -use serde::{Deserialize, Serialize}; - #[cfg(feature = "full")] use crate::schema::{ admin_purge_comment, @@ -19,6 +17,7 @@ use crate::schema::{ mod_sticky_post, mod_transfer_community, }; +use serde::{Deserialize, Serialize}; #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] #[cfg_attr(feature = "full", derive(Queryable, Identifiable))] diff --git a/crates/db_schema/src/source/password_reset_request.rs b/crates/db_schema/src/source/password_reset_request.rs index 159b0b7e..6c28c649 100644 --- a/crates/db_schema/src/source/password_reset_request.rs +++ b/crates/db_schema/src/source/password_reset_request.rs @@ -1,5 +1,4 @@ use crate::newtypes::LocalUserId; - #[cfg(feature = "full")] use crate::schema::password_reset_request; diff --git a/crates/db_schema/src/source/person.rs b/crates/db_schema/src/source/person.rs index 0d2706c5..9a5a9f7c 100644 --- a/crates/db_schema/src/source/person.rs +++ b/crates/db_schema/src/source/person.rs @@ -1,9 +1,8 @@ use crate::newtypes::{DbUrl, InstanceId, PersonId}; -use serde::{Deserialize, Serialize}; -use typed_builder::TypedBuilder; - #[cfg(feature = "full")] use crate::schema::person; +use serde::{Deserialize, Serialize}; +use typed_builder::TypedBuilder; #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] #[cfg_attr(feature = "full", derive(Queryable, Identifiable))] diff --git a/crates/db_schema/src/source/person_block.rs b/crates/db_schema/src/source/person_block.rs index e5a365b5..f9bd6e56 100644 --- a/crates/db_schema/src/source/person_block.rs +++ b/crates/db_schema/src/source/person_block.rs @@ -1,8 +1,7 @@ use crate::newtypes::{PersonBlockId, PersonId}; -use serde::{Deserialize, Serialize}; - #[cfg(feature = "full")] use crate::schema::person_block; +use serde::{Deserialize, Serialize}; #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] #[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable))] diff --git a/crates/db_schema/src/source/person_mention.rs b/crates/db_schema/src/source/person_mention.rs index b4a2ce59..45892d3a 100644 --- a/crates/db_schema/src/source/person_mention.rs +++ b/crates/db_schema/src/source/person_mention.rs @@ -1,8 +1,7 @@ use crate::newtypes::{CommentId, PersonId, PersonMentionId}; -use serde::{Deserialize, Serialize}; - #[cfg(feature = "full")] use crate::schema::person_mention; +use serde::{Deserialize, Serialize}; #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] #[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable))] diff --git a/crates/db_schema/src/source/post.rs b/crates/db_schema/src/source/post.rs index 9af6a3f2..df3116ef 100644 --- a/crates/db_schema/src/source/post.rs +++ b/crates/db_schema/src/source/post.rs @@ -1,9 +1,8 @@ use crate::newtypes::{CommunityId, DbUrl, LanguageId, PersonId, PostId}; -use serde::{Deserialize, Serialize}; -use typed_builder::TypedBuilder; - #[cfg(feature = "full")] use crate::schema::{post, post_like, post_read, post_saved}; +use serde::{Deserialize, Serialize}; +use typed_builder::TypedBuilder; #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] #[cfg_attr(feature = "full", derive(Queryable, Identifiable))] diff --git a/crates/db_schema/src/source/post_report.rs b/crates/db_schema/src/source/post_report.rs index abee0f32..a9f3351b 100644 --- a/crates/db_schema/src/source/post_report.rs +++ b/crates/db_schema/src/source/post_report.rs @@ -1,8 +1,7 @@ use crate::newtypes::{DbUrl, PersonId, PostId, PostReportId}; -use serde::{Deserialize, Serialize}; - #[cfg(feature = "full")] use crate::schema::post_report; +use serde::{Deserialize, Serialize}; #[derive(PartialEq, Eq, Serialize, Deserialize, Debug, Clone)] #[cfg_attr(feature = "full", derive(Identifiable, Queryable, Associations))] diff --git a/crates/db_schema/src/source/private_message.rs b/crates/db_schema/src/source/private_message.rs index f6e969f3..da446ffa 100644 --- a/crates/db_schema/src/source/private_message.rs +++ b/crates/db_schema/src/source/private_message.rs @@ -1,9 +1,8 @@ use crate::newtypes::{DbUrl, PersonId, PrivateMessageId}; -use serde::{Deserialize, Serialize}; -use typed_builder::TypedBuilder; - #[cfg(feature = "full")] use crate::schema::private_message; +use serde::{Deserialize, Serialize}; +use typed_builder::TypedBuilder; #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] #[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable))] diff --git a/crates/db_schema/src/source/private_message_report.rs b/crates/db_schema/src/source/private_message_report.rs index 8cf3b0f0..f35b259f 100644 --- a/crates/db_schema/src/source/private_message_report.rs +++ b/crates/db_schema/src/source/private_message_report.rs @@ -1,8 +1,7 @@ use crate::newtypes::{PersonId, PrivateMessageId, PrivateMessageReportId}; -use serde::{Deserialize, Serialize}; - #[cfg(feature = "full")] use crate::schema::private_message_report; +use serde::{Deserialize, Serialize}; #[derive(PartialEq, Eq, Serialize, Deserialize, Debug, Clone)] #[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable))] diff --git a/crates/db_schema/src/source/registration_application.rs b/crates/db_schema/src/source/registration_application.rs index 40f00bdf..1e26664d 100644 --- a/crates/db_schema/src/source/registration_application.rs +++ b/crates/db_schema/src/source/registration_application.rs @@ -1,8 +1,7 @@ use crate::newtypes::{LocalUserId, PersonId}; -use serde::{Deserialize, Serialize}; - #[cfg(feature = "full")] use crate::schema::registration_application; +use serde::{Deserialize, Serialize}; #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] #[cfg_attr(feature = "full", derive(Queryable, Identifiable))] diff --git a/crates/db_schema/src/source/site.rs b/crates/db_schema/src/source/site.rs index 8c4a5b1c..21a0cd31 100644 --- a/crates/db_schema/src/source/site.rs +++ b/crates/db_schema/src/source/site.rs @@ -1,9 +1,8 @@ use crate::newtypes::{DbUrl, InstanceId, SiteId}; -use serde::{Deserialize, Serialize}; -use typed_builder::TypedBuilder; - #[cfg(feature = "full")] use crate::schema::site; +use serde::{Deserialize, Serialize}; +use typed_builder::TypedBuilder; #[derive(PartialEq, Eq, Debug, Clone, Serialize, Deserialize)] #[cfg_attr(feature = "full", derive(Queryable, Identifiable))] diff --git a/crates/utils/src/test.rs b/crates/utils/src/test.rs index e7bfdb59..40e32182 100644 --- a/crates/utils/src/test.rs +++ b/crates/utils/src/test.rs @@ -1,5 +1,3 @@ -use regex::RegexBuilder; - use crate::utils::{ is_valid_actor_name, is_valid_display_name, @@ -10,6 +8,7 @@ use crate::utils::{ slur_check, slurs_vec_to_str, }; +use regex::RegexBuilder; #[test] fn test_mentions_regex() {