From faef62e073086b3fbc11ee36bde0e8e8c96e24a6 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Mon, 9 Dec 2019 11:08:19 -0800 Subject: [PATCH] Switching to shorthands for rust params. --- server/src/api/comment.rs | 6 +++--- server/src/api/community.rs | 24 +++++++++++------------ server/src/api/mod.rs | 2 +- server/src/api/post.rs | 16 ++++++++-------- server/src/api/site.rs | 36 +++++++++++++++++------------------ server/src/api/user.rs | 18 +++++++++--------- server/src/db/comment_view.rs | 2 +- 7 files changed, 52 insertions(+), 52 deletions(-) diff --git a/server/src/api/comment.rs b/server/src/api/comment.rs index a5ccd358..eb5da62b 100644 --- a/server/src/api/comment.rs +++ b/server/src/api/comment.rs @@ -118,7 +118,7 @@ impl Perform for Oper { let like_form = CommentLikeForm { comment_id: inserted_comment.id, post_id: data.post_id, - user_id: user_id, + user_id, score: 1, }; @@ -262,7 +262,7 @@ impl Perform for Oper { let comment_saved_form = CommentSavedForm { comment_id: data.comment_id, - user_id: user_id, + user_id, }; if data.save { @@ -312,7 +312,7 @@ impl Perform for Oper { let like_form = CommentLikeForm { comment_id: data.comment_id, post_id: data.post_id, - user_id: user_id, + user_id, score: data.score, }; diff --git a/server/src/api/community.rs b/server/src/api/community.rs index 5bd60007..9492d75d 100644 --- a/server/src/api/community.rs +++ b/server/src/api/community.rs @@ -163,8 +163,8 @@ impl Perform for Oper { Ok(GetCommunityResponse { op: self.op.to_string(), community: community_view, - moderators: moderators, - admins: admins, + moderators, + admins, }) } } @@ -213,7 +213,7 @@ impl Perform for Oper { let community_moderator_form = CommunityModeratorForm { community_id: inserted_community.id, - user_id: user_id, + user_id, }; let _inserted_community_moderator = @@ -229,7 +229,7 @@ impl Perform for Oper { let community_follower_form = CommunityFollowerForm { community_id: inserted_community.id, - user_id: user_id, + user_id, }; let _inserted_community_follower = @@ -310,7 +310,7 @@ impl Perform for Oper { community_id: data.edit_id, removed: Some(removed), reason: data.reason.to_owned(), - expires: expires, + expires, }; ModRemoveCommunity::create(&conn, &form)?; } @@ -360,7 +360,7 @@ impl Perform for Oper { // Return the jwt Ok(ListCommunitiesResponse { op: self.op.to_string(), - communities: communities, + communities, }) } } @@ -379,7 +379,7 @@ impl Perform for Oper { let community_follower_form = CommunityFollowerForm { community_id: data.community_id, - user_id: user_id, + user_id, }; if data.follow { @@ -424,7 +424,7 @@ impl Perform for Oper { // Return the jwt Ok(GetFollowedCommunitiesResponse { op: self.op.to_string(), - communities: communities, + communities, }) } } @@ -470,7 +470,7 @@ impl Perform for Oper { community_id: data.community_id, reason: data.reason.to_owned(), banned: Some(data.ban), - expires: expires, + expires, }; ModBanFromCommunity::create(&conn, &form)?; @@ -536,7 +536,7 @@ impl Perform for Oper { Ok(AddModToCommunityResponse { op: self.op.to_string(), - moderators: moderators, + moderators, }) } } @@ -641,8 +641,8 @@ impl Perform for Oper { Ok(GetCommunityResponse { op: self.op.to_string(), community: community_view, - moderators: moderators, - admins: admins, + moderators, + admins, }) } } diff --git a/server/src/api/mod.rs b/server/src/api/mod.rs index 6b1a6f6e..2d5dec87 100644 --- a/server/src/api/mod.rs +++ b/server/src/api/mod.rs @@ -89,7 +89,7 @@ pub struct Oper { impl Oper { pub fn new(op: UserOperation, data: T) -> Oper { - Oper { op: op, data: data } + Oper { op, data } } } diff --git a/server/src/api/post.rs b/server/src/api/post.rs index 5b41b426..4855865b 100644 --- a/server/src/api/post.rs +++ b/server/src/api/post.rs @@ -134,7 +134,7 @@ impl Perform for Oper { // They like their own post by default let like_form = PostLikeForm { post_id: inserted_post.id, - user_id: user_id, + user_id, score: 1, }; @@ -198,10 +198,10 @@ impl Perform for Oper { Ok(GetPostResponse { op: self.op.to_string(), post: post_view, - comments: comments, - community: community, - moderators: moderators, - admins: admins, + comments, + community, + moderators, + admins, }) } } @@ -248,7 +248,7 @@ impl Perform for Oper { Ok(GetPostsResponse { op: self.op.to_string(), - posts: posts, + posts, }) } } @@ -278,7 +278,7 @@ impl Perform for Oper { let like_form = PostLikeForm { post_id: data.post_id, - user_id: user_id, + user_id, score: data.score, }; @@ -417,7 +417,7 @@ impl Perform for Oper { let post_saved_form = PostSavedForm { post_id: data.post_id, - user_id: user_id, + user_id, }; if data.save { diff --git a/server/src/api/site.rs b/server/src/api/site.rs index e2963d8c..26111467 100644 --- a/server/src/api/site.rs +++ b/server/src/api/site.rs @@ -100,7 +100,7 @@ impl Perform for Oper { // Return the jwt Ok(ListCategoriesResponse { op: self.op.to_string(), - categories: categories, + categories, }) } } @@ -168,15 +168,15 @@ impl Perform for Oper { // Return the jwt Ok(GetModlogResponse { op: self.op.to_string(), - removed_posts: removed_posts, - locked_posts: locked_posts, - stickied_posts: stickied_posts, - removed_comments: removed_comments, - removed_communities: removed_communities, - banned_from_community: banned_from_community, - banned: banned, - added_to_community: added_to_community, - added: added, + removed_posts, + locked_posts, + stickied_posts, + removed_comments, + removed_communities, + banned_from_community, + banned, + added_to_community, + added, }) } } @@ -295,8 +295,8 @@ impl Perform for Oper { Ok(GetSiteResponse { op: self.op.to_string(), site: site_view, - admins: admins, - banned: banned, + admins, + banned, online: 0, }) } @@ -399,10 +399,10 @@ impl Perform for Oper { Ok(SearchResponse { op: self.op.to_string(), type_: data.type_.to_owned(), - comments: comments, - posts: posts, - communities: communities, - users: users, + comments, + posts, + communities, + users, }) } } @@ -462,8 +462,8 @@ impl Perform for Oper { Ok(GetSiteResponse { op: self.op.to_string(), site: Some(site_view), - admins: admins, - banned: banned, + admins, + banned, online: 0, }) } diff --git a/server/src/api/user.rs b/server/src/api/user.rs index bc51c8e9..ebbe48a2 100644 --- a/server/src/api/user.rs +++ b/server/src/api/user.rs @@ -407,11 +407,11 @@ impl Perform for Oper { Ok(GetUserDetailsResponse { op: self.op.to_string(), user: user_view, - follows: follows, - moderates: moderates, - comments: comments, - posts: posts, - admins: admins, + follows, + moderates, + comments, + posts, + admins, }) } } @@ -473,7 +473,7 @@ impl Perform for Oper { Ok(AddAdminResponse { op: self.op.to_string(), - admins: admins, + admins, }) } } @@ -529,7 +529,7 @@ impl Perform for Oper { other_user_id: data.user_id, reason: data.reason.to_owned(), banned: Some(data.ban), - expires: expires, + expires, }; ModBan::create(&conn, &form)?; @@ -567,7 +567,7 @@ impl Perform for Oper { Ok(GetRepliesResponse { op: self.op.to_string(), - replies: replies, + replies, }) } } @@ -595,7 +595,7 @@ impl Perform for Oper { Ok(GetUserMentionsResponse { op: self.op.to_string(), - mentions: mentions, + mentions, }) } } diff --git a/server/src/db/comment_view.rs b/server/src/db/comment_view.rs index 54c43b93..f9c00b20 100644 --- a/server/src/db/comment_view.rs +++ b/server/src/db/comment_view.rs @@ -313,7 +313,7 @@ impl<'a> ReplyQueryBuilder<'a> { ReplyQueryBuilder { conn, query, - for_user_id: for_user_id, + for_user_id, sort: &SortType::New, unread_only: false, page: None, -- 2.44.1