Group imports dess (#2526)

* Group imports with rustfmt

* Running cargo fmt again.

Co-authored-by: Felix Ableitner <me@nutomic.com>
This commit is contained in:
Dessalines 2022-11-02 15:18:22 -04:00 committed by GitHub
parent 28eade6168
commit cb753b045f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
32 changed files with 57 additions and 88 deletions

View file

@ -2,4 +2,4 @@ tab_spaces = 2
edition="2021" edition="2021"
imports_layout="HorizontalVertical" imports_layout="HorizontalVertical"
imports_granularity="Crate" imports_granularity="Crate"
reorder_imports=true group_imports="One"

View file

@ -1,3 +1,4 @@
use crate::PerformCrud;
use actix_web::web::Data; use actix_web::web::Data;
use lemmy_api_common::{ use lemmy_api_common::{
comment::{CommentResponse, EditComment}, comment::{CommentResponse, EditComment},
@ -35,8 +36,6 @@ use lemmy_websocket::{
UserOperationCrud, UserOperationCrud,
}; };
use crate::PerformCrud;
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl PerformCrud for EditComment { impl PerformCrud for EditComment {
type Response = CommentResponse; type Response = CommentResponse;

View file

@ -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::{ use activitypub_federation::{
core::object_id::ObjectId, core::object_id::ObjectId,
data::Data, data::Data,
@ -18,21 +32,6 @@ use lemmy_utils::error::LemmyError;
use lemmy_websocket::LemmyContext; use lemmy_websocket::LemmyContext;
use url::Url; 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 { impl UndoBlockUser {
#[tracing::instrument(skip_all)] #[tracing::instrument(skip_all)]
pub async fn send( pub async fn send(

View file

@ -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_api_common::utils::blocking;
use lemmy_db_schema::{ use lemmy_db_schema::{
source::{ source::{
@ -13,11 +17,6 @@ use lemmy_websocket::{
UserOperation, UserOperation,
}; };
use crate::{
objects::{comment::ApubComment, person::ApubPerson, post::ApubPost},
protocol::activities::voting::vote::VoteType,
};
pub mod undo_vote; pub mod undo_vote;
pub mod vote; pub mod vote;

View file

@ -1,6 +1,5 @@
use lemmy_websocket::LemmyContext;
use crate::objects::community::ApubCommunity; use crate::objects::community::ApubCommunity;
use lemmy_websocket::LemmyContext;
pub(crate) mod community_moderators; pub(crate) mod community_moderators;
pub(crate) mod community_outbox; pub(crate) mod community_outbox;

View file

@ -1,6 +1,4 @@
use crate::newtypes::{CommentId, CommunityId, PersonId, PostId}; use crate::newtypes::{CommentId, CommunityId, PersonId, PostId};
use serde::{Deserialize, Serialize};
#[cfg(feature = "full")] #[cfg(feature = "full")]
use crate::schema::{ use crate::schema::{
comment_aggregates, comment_aggregates,
@ -10,6 +8,7 @@ use crate::schema::{
post_aggregates, post_aggregates,
site_aggregates, site_aggregates,
}; };
use serde::{Deserialize, Serialize};
#[derive(PartialEq, Eq, Debug, Serialize, Deserialize, Clone)] #[derive(PartialEq, Eq, Debug, Serialize, Deserialize, Clone)]
#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable))] #[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable))]

View file

@ -7,10 +7,9 @@ use crate::newtypes::{
SiteId, SiteId,
SiteLanguageId, SiteLanguageId,
}; };
use serde::{Deserialize, Serialize};
#[cfg(feature = "full")] #[cfg(feature = "full")]
use crate::schema::local_user_language; use crate::schema::local_user_language;
use serde::{Deserialize, Serialize};
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Identifiable))] #[cfg_attr(feature = "full", derive(Queryable, Identifiable))]

View file

@ -1,11 +1,10 @@
use crate::newtypes::{CommentId, DbUrl, LanguageId, LtreeDef, PersonId, PostId}; 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 diesel_ltree::Ltree;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use typed_builder::TypedBuilder; use typed_builder::TypedBuilder;
#[cfg(feature = "full")]
use crate::schema::{comment, comment_like, comment_saved};
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable))] #[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable))]
#[cfg_attr(feature = "full", diesel(belongs_to(crate::source::post::Post)))] #[cfg_attr(feature = "full", diesel(belongs_to(crate::source::post::Post)))]

View file

@ -1,8 +1,7 @@
use crate::newtypes::{CommentId, CommentReplyId, PersonId}; use crate::newtypes::{CommentId, CommentReplyId, PersonId};
use serde::{Deserialize, Serialize};
#[cfg(feature = "full")] #[cfg(feature = "full")]
use crate::schema::comment_reply; use crate::schema::comment_reply;
use serde::{Deserialize, Serialize};
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable))] #[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable))]

View file

@ -1,8 +1,7 @@
use crate::newtypes::{CommentId, CommentReportId, PersonId}; use crate::newtypes::{CommentId, CommentReportId, PersonId};
use serde::{Deserialize, Serialize};
#[cfg(feature = "full")] #[cfg(feature = "full")]
use crate::schema::comment_report; use crate::schema::comment_report;
use serde::{Deserialize, Serialize};
#[derive(PartialEq, Eq, Serialize, Deserialize, Debug, Clone)] #[derive(PartialEq, Eq, Serialize, Deserialize, Debug, Clone)]
#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable))] #[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable))]

View file

@ -1,9 +1,8 @@
use crate::newtypes::{CommunityId, DbUrl, InstanceId, PersonId}; use crate::newtypes::{CommunityId, DbUrl, InstanceId, PersonId};
use serde::{Deserialize, Serialize};
use typed_builder::TypedBuilder;
#[cfg(feature = "full")] #[cfg(feature = "full")]
use crate::schema::{community, community_follower, community_moderator, community_person_ban}; 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)] #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Identifiable))] #[cfg_attr(feature = "full", derive(Queryable, Identifiable))]

View file

@ -1,8 +1,7 @@
use crate::newtypes::{CommunityBlockId, CommunityId, PersonId}; use crate::newtypes::{CommunityBlockId, CommunityId, PersonId};
use serde::{Deserialize, Serialize};
#[cfg(feature = "full")] #[cfg(feature = "full")]
use crate::schema::community_block; use crate::schema::community_block;
use serde::{Deserialize, Serialize};
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable))] #[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable))]

View file

@ -1,5 +1,4 @@
use crate::newtypes::LocalUserId; use crate::newtypes::LocalUserId;
#[cfg(feature = "full")] #[cfg(feature = "full")]
use crate::schema::email_verification; use crate::schema::email_verification;

View file

@ -1,9 +1,8 @@
use crate::newtypes::InstanceId; use crate::newtypes::InstanceId;
use serde::{Deserialize, Serialize};
use std::fmt::Debug;
#[cfg(feature = "full")] #[cfg(feature = "full")]
use crate::schema::federation_allowlist; use crate::schema::federation_allowlist;
use serde::{Deserialize, Serialize};
use std::fmt::Debug;
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable))] #[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable))]

View file

@ -1,9 +1,8 @@
use crate::newtypes::InstanceId; use crate::newtypes::InstanceId;
use serde::{Deserialize, Serialize};
use std::fmt::Debug;
#[cfg(feature = "full")] #[cfg(feature = "full")]
use crate::schema::federation_blocklist; use crate::schema::federation_blocklist;
use serde::{Deserialize, Serialize};
use std::fmt::Debug;
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable))] #[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable))]

View file

@ -1,8 +1,7 @@
use crate::newtypes::InstanceId; use crate::newtypes::InstanceId;
use std::fmt::Debug;
#[cfg(feature = "full")] #[cfg(feature = "full")]
use crate::schema::instance; use crate::schema::instance;
use std::fmt::Debug;
#[derive(PartialEq, Eq, Debug)] #[derive(PartialEq, Eq, Debug)]
#[cfg_attr(feature = "full", derive(Queryable, Identifiable))] #[cfg_attr(feature = "full", derive(Queryable, Identifiable))]

View file

@ -1,8 +1,7 @@
use crate::newtypes::LanguageId; use crate::newtypes::LanguageId;
use serde::{Deserialize, Serialize};
#[cfg(feature = "full")] #[cfg(feature = "full")]
use crate::schema::language; use crate::schema::language;
use serde::{Deserialize, Serialize};
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Identifiable))] #[cfg_attr(feature = "full", derive(Queryable, Identifiable))]

View file

@ -1,9 +1,8 @@
use crate::newtypes::{LocalSiteId, SiteId}; use crate::newtypes::{LocalSiteId, SiteId};
use serde::{Deserialize, Serialize};
use typed_builder::TypedBuilder;
#[cfg(feature = "full")] #[cfg(feature = "full")]
use crate::schema::local_site; use crate::schema::local_site;
use serde::{Deserialize, Serialize};
use typed_builder::TypedBuilder;
#[derive(PartialEq, Eq, Debug, Clone, Serialize, Deserialize)] #[derive(PartialEq, Eq, Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Identifiable))] #[cfg_attr(feature = "full", derive(Queryable, Identifiable))]

View file

@ -1,9 +1,8 @@
use crate::newtypes::LocalSiteId; use crate::newtypes::LocalSiteId;
use serde::{Deserialize, Serialize};
use typed_builder::TypedBuilder;
#[cfg(feature = "full")] #[cfg(feature = "full")]
use crate::schema::local_site_rate_limit; use crate::schema::local_site_rate_limit;
use serde::{Deserialize, Serialize};
use typed_builder::TypedBuilder;
#[derive(PartialEq, Eq, Debug, Clone, Serialize, Deserialize)] #[derive(PartialEq, Eq, Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Identifiable))] #[cfg_attr(feature = "full", derive(Queryable, Identifiable))]

View file

@ -1,9 +1,8 @@
use crate::newtypes::{LocalUserId, PersonId}; use crate::newtypes::{LocalUserId, PersonId};
use serde::{Deserialize, Serialize};
use typed_builder::TypedBuilder;
#[cfg(feature = "full")] #[cfg(feature = "full")]
use crate::schema::local_user; use crate::schema::local_user;
use serde::{Deserialize, Serialize};
use typed_builder::TypedBuilder;
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Identifiable))] #[cfg_attr(feature = "full", derive(Queryable, Identifiable))]

View file

@ -1,6 +1,4 @@
use crate::newtypes::{CommentId, CommunityId, PersonId, PostId}; use crate::newtypes::{CommentId, CommunityId, PersonId, PostId};
use serde::{Deserialize, Serialize};
#[cfg(feature = "full")] #[cfg(feature = "full")]
use crate::schema::{ use crate::schema::{
admin_purge_comment, admin_purge_comment,
@ -19,6 +17,7 @@ use crate::schema::{
mod_sticky_post, mod_sticky_post,
mod_transfer_community, mod_transfer_community,
}; };
use serde::{Deserialize, Serialize};
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Identifiable))] #[cfg_attr(feature = "full", derive(Queryable, Identifiable))]

View file

@ -1,5 +1,4 @@
use crate::newtypes::LocalUserId; use crate::newtypes::LocalUserId;
#[cfg(feature = "full")] #[cfg(feature = "full")]
use crate::schema::password_reset_request; use crate::schema::password_reset_request;

View file

@ -1,9 +1,8 @@
use crate::newtypes::{DbUrl, InstanceId, PersonId}; use crate::newtypes::{DbUrl, InstanceId, PersonId};
use serde::{Deserialize, Serialize};
use typed_builder::TypedBuilder;
#[cfg(feature = "full")] #[cfg(feature = "full")]
use crate::schema::person; use crate::schema::person;
use serde::{Deserialize, Serialize};
use typed_builder::TypedBuilder;
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Identifiable))] #[cfg_attr(feature = "full", derive(Queryable, Identifiable))]

View file

@ -1,8 +1,7 @@
use crate::newtypes::{PersonBlockId, PersonId}; use crate::newtypes::{PersonBlockId, PersonId};
use serde::{Deserialize, Serialize};
#[cfg(feature = "full")] #[cfg(feature = "full")]
use crate::schema::person_block; use crate::schema::person_block;
use serde::{Deserialize, Serialize};
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable))] #[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable))]

View file

@ -1,8 +1,7 @@
use crate::newtypes::{CommentId, PersonId, PersonMentionId}; use crate::newtypes::{CommentId, PersonId, PersonMentionId};
use serde::{Deserialize, Serialize};
#[cfg(feature = "full")] #[cfg(feature = "full")]
use crate::schema::person_mention; use crate::schema::person_mention;
use serde::{Deserialize, Serialize};
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable))] #[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable))]

View file

@ -1,9 +1,8 @@
use crate::newtypes::{CommunityId, DbUrl, LanguageId, PersonId, PostId}; use crate::newtypes::{CommunityId, DbUrl, LanguageId, PersonId, PostId};
use serde::{Deserialize, Serialize};
use typed_builder::TypedBuilder;
#[cfg(feature = "full")] #[cfg(feature = "full")]
use crate::schema::{post, post_like, post_read, post_saved}; 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)] #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Identifiable))] #[cfg_attr(feature = "full", derive(Queryable, Identifiable))]

View file

@ -1,8 +1,7 @@
use crate::newtypes::{DbUrl, PersonId, PostId, PostReportId}; use crate::newtypes::{DbUrl, PersonId, PostId, PostReportId};
use serde::{Deserialize, Serialize};
#[cfg(feature = "full")] #[cfg(feature = "full")]
use crate::schema::post_report; use crate::schema::post_report;
use serde::{Deserialize, Serialize};
#[derive(PartialEq, Eq, Serialize, Deserialize, Debug, Clone)] #[derive(PartialEq, Eq, Serialize, Deserialize, Debug, Clone)]
#[cfg_attr(feature = "full", derive(Identifiable, Queryable, Associations))] #[cfg_attr(feature = "full", derive(Identifiable, Queryable, Associations))]

View file

@ -1,9 +1,8 @@
use crate::newtypes::{DbUrl, PersonId, PrivateMessageId}; use crate::newtypes::{DbUrl, PersonId, PrivateMessageId};
use serde::{Deserialize, Serialize};
use typed_builder::TypedBuilder;
#[cfg(feature = "full")] #[cfg(feature = "full")]
use crate::schema::private_message; use crate::schema::private_message;
use serde::{Deserialize, Serialize};
use typed_builder::TypedBuilder;
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable))] #[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable))]

View file

@ -1,8 +1,7 @@
use crate::newtypes::{PersonId, PrivateMessageId, PrivateMessageReportId}; use crate::newtypes::{PersonId, PrivateMessageId, PrivateMessageReportId};
use serde::{Deserialize, Serialize};
#[cfg(feature = "full")] #[cfg(feature = "full")]
use crate::schema::private_message_report; use crate::schema::private_message_report;
use serde::{Deserialize, Serialize};
#[derive(PartialEq, Eq, Serialize, Deserialize, Debug, Clone)] #[derive(PartialEq, Eq, Serialize, Deserialize, Debug, Clone)]
#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable))] #[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable))]

View file

@ -1,8 +1,7 @@
use crate::newtypes::{LocalUserId, PersonId}; use crate::newtypes::{LocalUserId, PersonId};
use serde::{Deserialize, Serialize};
#[cfg(feature = "full")] #[cfg(feature = "full")]
use crate::schema::registration_application; use crate::schema::registration_application;
use serde::{Deserialize, Serialize};
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Identifiable))] #[cfg_attr(feature = "full", derive(Queryable, Identifiable))]

View file

@ -1,9 +1,8 @@
use crate::newtypes::{DbUrl, InstanceId, SiteId}; use crate::newtypes::{DbUrl, InstanceId, SiteId};
use serde::{Deserialize, Serialize};
use typed_builder::TypedBuilder;
#[cfg(feature = "full")] #[cfg(feature = "full")]
use crate::schema::site; use crate::schema::site;
use serde::{Deserialize, Serialize};
use typed_builder::TypedBuilder;
#[derive(PartialEq, Eq, Debug, Clone, Serialize, Deserialize)] #[derive(PartialEq, Eq, Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Identifiable))] #[cfg_attr(feature = "full", derive(Queryable, Identifiable))]

View file

@ -1,5 +1,3 @@
use regex::RegexBuilder;
use crate::utils::{ use crate::utils::{
is_valid_actor_name, is_valid_actor_name,
is_valid_display_name, is_valid_display_name,
@ -10,6 +8,7 @@ use crate::utils::{
slur_check, slur_check,
slurs_vec_to_str, slurs_vec_to_str,
}; };
use regex::RegexBuilder;
#[test] #[test]
fn test_mentions_regex() { fn test_mentions_regex() {