]> Untitled Git - lemmy.git/commitdiff
Switching to shorthands for rust params.
authorDessalines <tyhou13@gmx.com>
Mon, 9 Dec 2019 19:08:19 +0000 (11:08 -0800)
committerDessalines <tyhou13@gmx.com>
Mon, 9 Dec 2019 19:08:19 +0000 (11:08 -0800)
server/src/api/comment.rs
server/src/api/community.rs
server/src/api/mod.rs
server/src/api/post.rs
server/src/api/site.rs
server/src/api/user.rs
server/src/db/comment_view.rs

index a5ccd358c8055e4ff25a1c3f8f15430a72b72faa..eb5da62badb5d7885bf882700f61f0be3d8a9f30 100644 (file)
@@ -118,7 +118,7 @@ impl Perform<CommentResponse> for Oper<CreateComment> {
     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<CommentResponse> for Oper<SaveComment> {
 
     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<CommentResponse> for Oper<CreateCommentLike> {
     let like_form = CommentLikeForm {
       comment_id: data.comment_id,
       post_id: data.post_id,
-      user_id: user_id,
+      user_id,
       score: data.score,
     };
 
index 5bd600077957051bfd12ba971c4beb027459ef5c..9492d75d377072dbc1ad08331a3224be245eb3ca 100644 (file)
@@ -163,8 +163,8 @@ impl Perform<GetCommunityResponse> for Oper<GetCommunity> {
     Ok(GetCommunityResponse {
       op: self.op.to_string(),
       community: community_view,
-      moderators: moderators,
-      admins: admins,
+      moderators,
+      admins,
     })
   }
 }
@@ -213,7 +213,7 @@ impl Perform<CommunityResponse> for Oper<CreateCommunity> {
 
     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<CommunityResponse> for Oper<CreateCommunity> {
 
     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<CommunityResponse> for Oper<EditCommunity> {
         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<ListCommunitiesResponse> for Oper<ListCommunities> {
     // Return the jwt
     Ok(ListCommunitiesResponse {
       op: self.op.to_string(),
-      communities: communities,
+      communities,
     })
   }
 }
@@ -379,7 +379,7 @@ impl Perform<CommunityResponse> for Oper<FollowCommunity> {
 
     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<GetFollowedCommunitiesResponse> for Oper<GetFollowedCommunities> {
     // Return the jwt
     Ok(GetFollowedCommunitiesResponse {
       op: self.op.to_string(),
-      communities: communities,
+      communities,
     })
   }
 }
@@ -470,7 +470,7 @@ impl Perform<BanFromCommunityResponse> for Oper<BanFromCommunity> {
       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<AddModToCommunityResponse> for Oper<AddModToCommunity> {
 
     Ok(AddModToCommunityResponse {
       op: self.op.to_string(),
-      moderators: moderators,
+      moderators,
     })
   }
 }
@@ -641,8 +641,8 @@ impl Perform<GetCommunityResponse> for Oper<TransferCommunity> {
     Ok(GetCommunityResponse {
       op: self.op.to_string(),
       community: community_view,
-      moderators: moderators,
-      admins: admins,
+      moderators,
+      admins,
     })
   }
 }
index 6b1a6f6e188cb4625ad351df60625e24a9f64e6b..2d5dec8706097619d99a8a312d2a92f06acb3a4e 100644 (file)
@@ -89,7 +89,7 @@ pub struct Oper<T> {
 
 impl<T> Oper<T> {
   pub fn new(op: UserOperation, data: T) -> Oper<T> {
-    Oper { op: op, data: data }
+    Oper { op, data }
   }
 }
 
index 5b41b4267b9cd75ef05b200035bf5022e8c6e451..4855865b00d627efe4fde84879ca3ba39b03da83 100644 (file)
@@ -134,7 +134,7 @@ impl Perform<PostResponse> for Oper<CreatePost> {
     // 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<GetPostResponse> for Oper<GetPost> {
     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<GetPostsResponse> for Oper<GetPosts> {
 
     Ok(GetPostsResponse {
       op: self.op.to_string(),
-      posts: posts,
+      posts,
     })
   }
 }
@@ -278,7 +278,7 @@ impl Perform<CreatePostLikeResponse> for Oper<CreatePostLike> {
 
     let like_form = PostLikeForm {
       post_id: data.post_id,
-      user_id: user_id,
+      user_id,
       score: data.score,
     };
 
@@ -417,7 +417,7 @@ impl Perform<PostResponse> for Oper<SavePost> {
 
     let post_saved_form = PostSavedForm {
       post_id: data.post_id,
-      user_id: user_id,
+      user_id,
     };
 
     if data.save {
index e2963d8c612740069d5d7e18e103210057edf9f4..26111467679048c1fa5b473a354f4883226a0119 100644 (file)
@@ -100,7 +100,7 @@ impl Perform<ListCategoriesResponse> for Oper<ListCategories> {
     // Return the jwt
     Ok(ListCategoriesResponse {
       op: self.op.to_string(),
-      categories: categories,
+      categories,
     })
   }
 }
@@ -168,15 +168,15 @@ impl Perform<GetModlogResponse> for Oper<GetModlog> {
     // 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<GetSiteResponse> for Oper<GetSite> {
     Ok(GetSiteResponse {
       op: self.op.to_string(),
       site: site_view,
-      admins: admins,
-      banned: banned,
+      admins,
+      banned,
       online: 0,
     })
   }
@@ -399,10 +399,10 @@ impl Perform<SearchResponse> for Oper<Search> {
     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<GetSiteResponse> for Oper<TransferSite> {
     Ok(GetSiteResponse {
       op: self.op.to_string(),
       site: Some(site_view),
-      admins: admins,
-      banned: banned,
+      admins,
+      banned,
       online: 0,
     })
   }
index bc51c8e9bd60991ef7c459ff76875db54ff778f9..ebbe48a2fe15f10a54e4bb6d199412bdfa1d4693 100644 (file)
@@ -407,11 +407,11 @@ impl Perform<GetUserDetailsResponse> for Oper<GetUserDetails> {
     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<AddAdminResponse> for Oper<AddAdmin> {
 
     Ok(AddAdminResponse {
       op: self.op.to_string(),
-      admins: admins,
+      admins,
     })
   }
 }
@@ -529,7 +529,7 @@ impl Perform<BanUserResponse> for Oper<BanUser> {
       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<GetRepliesResponse> for Oper<GetReplies> {
 
     Ok(GetRepliesResponse {
       op: self.op.to_string(),
-      replies: replies,
+      replies,
     })
   }
 }
@@ -595,7 +595,7 @@ impl Perform<GetUserMentionsResponse> for Oper<GetUserMentions> {
 
     Ok(GetUserMentionsResponse {
       op: self.op.to_string(),
-      mentions: mentions,
+      mentions,
     })
   }
 }
index 54c43b93c8493477ec1b7eddb53c6f14157b4b1a..f9c00b2098b9178d45d32cdd66ec9e7b9f2fbbef 100644 (file)
@@ -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,