From: Felix Ableitner Date: Tue, 1 Sep 2020 13:20:22 +0000 (+0200) Subject: Remove wildcard imports (in particular super::*) X-Git-Url: http://these/git/%22https:/nerdica.net/%7B%24%7B%60data:application/static/%24%7B%60data:application/%7Bthis.imageSrc.unwrap%28%29%7D?a=commitdiff_plain;h=5d64dfd4dc6a6332d121a0595f762fe175d537af;p=lemmy.git Remove wildcard imports (in particular super::*) --- diff --git a/server/lemmy_db/src/comment.rs b/server/lemmy_db/src/comment.rs index c462db1b..9bf4c2a5 100644 --- a/server/lemmy_db/src/comment.rs +++ b/server/lemmy_db/src/comment.rs @@ -1,6 +1,9 @@ -use super::{post::Post, *}; +use super::{post::Post}; use crate::schema::{comment, comment_like, comment_saved}; use url::{ParseError, Url}; +use diesel::{dsl::*, result::Error, *}; +use serde::{Deserialize, Serialize}; +use crate::{Crud, naive_now, Likeable, Saveable}; // WITH RECURSIVE MyTree AS ( // SELECT * FROM comment WHERE parent_id IS NULL @@ -249,7 +252,8 @@ impl Saveable for CommentSaved { #[cfg(test)] mod tests { - use crate::{comment::*, community::*, post::*, tests::establish_unpooled_connection, user::*}; + use crate::{comment::*, community::*, post::*, tests::establish_unpooled_connection, user::*, SortType, ListingType}; + use crate::Crud; #[test] fn test_crud() { diff --git a/server/lemmy_db/src/lib.rs b/server/lemmy_db/src/lib.rs index a5805ef9..bf7d00ca 100644 --- a/server/lemmy_db/src/lib.rs +++ b/server/lemmy_db/src/lib.rs @@ -14,7 +14,7 @@ pub extern crate sha2; pub extern crate strum; use chrono::NaiveDateTime; -use diesel::{dsl::*, result::Error, *}; +use diesel::{result::Error, *}; use regex::Regex; use serde::{Deserialize, Serialize}; use std::{env, env::VarError}; diff --git a/server/lemmy_db/src/password_reset_request.rs b/server/lemmy_db/src/password_reset_request.rs index f248f0b4..a5335885 100644 --- a/server/lemmy_db/src/password_reset_request.rs +++ b/server/lemmy_db/src/password_reset_request.rs @@ -2,7 +2,7 @@ use crate::{ schema::{password_reset_request, password_reset_request::dsl::*}, Crud, }; -use diesel::{dsl::*, result::Error, *}; +use diesel::{dsl::*, result::Error, PgConnection, *}; use sha2::{Digest, Sha256}; #[derive(Queryable, Identifiable, PartialEq, Debug)] @@ -78,8 +78,10 @@ impl PasswordResetRequest { #[cfg(test)] mod tests { - use super::{super::user::*, *}; + use super::{super::user::*}; use crate::{tests::establish_unpooled_connection, ListingType, SortType}; + use crate::password_reset_request::PasswordResetRequest; + use crate::Crud; #[test] fn test_crud() { diff --git a/server/lemmy_db/src/private_message.rs b/server/lemmy_db/src/private_message.rs index 4361fa90..be54b9b2 100644 --- a/server/lemmy_db/src/private_message.rs +++ b/server/lemmy_db/src/private_message.rs @@ -121,7 +121,10 @@ impl PrivateMessage { } // TODO use this - pub fn upsert(conn: &PgConnection, private_message_form: &PrivateMessageForm) -> Result { + pub fn upsert( + conn: &PgConnection, + private_message_form: &PrivateMessageForm, + ) -> Result { use crate::schema::private_message::dsl::*; insert_into(private_message) .values(private_message_form) diff --git a/server/src/api/community.rs b/server/src/api/community.rs index a7b3b6c7..763a9114 100644 --- a/server/src/api/community.rs +++ b/server/src/api/community.rs @@ -1,6 +1,14 @@ -use super::*; use crate::{ - api::{is_admin, is_mod_or_admin, APIError, Perform}, + api::{ + check_slurs, + check_slurs_opt, + get_user_from_jwt, + get_user_from_jwt_opt, + is_admin, + is_mod_or_admin, + APIError, + Perform, + }, apub::ActorType, blocking, websocket::{ @@ -8,14 +16,22 @@ use crate::{ UserOperation, }, ConnectionId, + LemmyContext, + LemmyError, }; +use actix_web::web::Data; use anyhow::Context; 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, diff --git a/server/src/api/mod.rs b/server/src/api/mod.rs index 5f8706e0..1b213d9f 100644 --- a/server/src/api/mod.rs +++ b/server/src/api/mod.rs @@ -1,13 +1,10 @@ use crate::{api::claims::Claims, blocking, ConnectionId, DbPool, LemmyContext, LemmyError}; use actix_web::web::Data; use lemmy_db::{ - community::*, - community_view::*, - moderator::*, + community::Community, + community_view::CommunityUserBanView, post::Post, - site::*, - user::*, - user_view::*, + user::User_, Crud, }; use lemmy_utils::{slur_check, slurs_vec_to_str}; diff --git a/server/src/websocket/chat_server.rs b/server/src/websocket/chat_server.rs index 6ee22f8c..92633c06 100644 --- a/server/src/websocket/chat_server.rs +++ b/server/src/websocket/chat_server.rs @@ -1,6 +1,5 @@ -use super::*; use crate::{ - api::{comment::*, community::*, post::*, site::*, user::*, *}, + api::{comment::*, community::*, post::*, site::*, user::*, APIError}, rate_limit::RateLimit, websocket::{ handlers::{do_user_operation, to_json_string, Args}, @@ -15,10 +14,22 @@ use crate::{ PostId, UserId, }; +use actix::prelude::*; use anyhow::Context as acontext; use background_jobs::QueueHandle; +use diesel::{ + r2d2::{ConnectionManager, Pool}, + PgConnection, +}; use lemmy_utils::location_info; +use rand::rngs::ThreadRng; use reqwest::Client; +use serde::Serialize; +use serde_json::Value; +use std::{ + collections::{HashMap, HashSet}, + str::FromStr, +}; /// `ChatServer` manages chat rooms and responsible for coordinating chat /// session. diff --git a/server/src/websocket/handlers.rs b/server/src/websocket/handlers.rs index 812ef921..6d195ab0 100644 --- a/server/src/websocket/handlers.rs +++ b/server/src/websocket/handlers.rs @@ -1,4 +1,3 @@ -use super::*; use crate::{ api::Perform, rate_limit::RateLimit, @@ -12,8 +11,12 @@ use crate::{ LemmyContext, LemmyError, }; +use actix::{Actor, Context, Handler, ResponseFuture}; use actix_web::web; use lemmy_db::naive_now; +use log::{error, info}; +use rand::Rng; +use serde::{Deserialize, Serialize}; pub(super) struct Args<'a> { pub(super) context: LemmyContext, diff --git a/server/src/websocket/messages.rs b/server/src/websocket/messages.rs index 41b0cbc6..1289017c 100644 --- a/server/src/websocket/messages.rs +++ b/server/src/websocket/messages.rs @@ -1,6 +1,5 @@ -use super::*; use crate::{ - api::{comment::*, post::*}, + api::{comment::CommentResponse, post::PostResponse}, websocket::UserOperation, CommunityId, ConnectionId, @@ -8,6 +7,8 @@ use crate::{ PostId, UserId, }; +use actix::{prelude::*, Recipient}; +use serde::{Deserialize, Serialize}; /// Chat server sends this messages to session #[derive(Message)] diff --git a/server/src/websocket/mod.rs b/server/src/websocket/mod.rs index 8bf8766d..b0441819 100644 --- a/server/src/websocket/mod.rs +++ b/server/src/websocket/mod.rs @@ -2,20 +2,6 @@ pub mod chat_server; pub mod handlers; pub mod messages; -use actix::prelude::*; -use diesel::{ - r2d2::{ConnectionManager, Pool}, - PgConnection, -}; -use log::{error, info}; -use rand::{rngs::ThreadRng, Rng}; -use serde::{Deserialize, Serialize}; -use serde_json::Value; -use std::{ - collections::{HashMap, HashSet}, - str::FromStr, -}; - #[derive(EnumString, ToString, Debug, Clone)] pub enum UserOperation { Login,