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"
imports_layout="HorizontalVertical"
imports_granularity="Crate"
reorder_imports=true
group_imports="One"

View file

@ -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;

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::{
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(

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_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;

View file

@ -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;

View file

@ -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))]

View file

@ -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))]

View file

@ -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)))]

View file

@ -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))]

View file

@ -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))]

View file

@ -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))]

View file

@ -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))]

View file

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

View file

@ -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))]

View file

@ -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))]

View file

@ -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))]

View file

@ -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))]

View file

@ -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))]

View file

@ -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))]

View file

@ -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))]

View file

@ -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))]

View file

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

View file

@ -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))]

View file

@ -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))]

View file

@ -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))]

View file

@ -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))]

View file

@ -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))]

View file

@ -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))]

View file

@ -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))]

View file

@ -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))]

View file

@ -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))]

View file

@ -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() {