From: phankydn <42137630+phankydn@users.noreply.github.com> Date: Tue, 23 May 2023 23:00:19 +0000 (+0700) Subject: Remove unnecessary clone (#2874) X-Git-Url: http://these/git/%22https:/nerdica.net/%7B%24%7B%60data:application/readmes/static/git-logo.png?a=commitdiff_plain;h=4a7050200700073f9c328f4aa7394c1968b9d120;p=lemmy.git Remove unnecessary clone (#2874) Co-authored-by: KyP --- diff --git a/crates/api/src/comment/like.rs b/crates/api/src/comment/like.rs index 3d216872..6946b60c 100644 --- a/crates/api/src/comment/like.rs +++ b/crates/api/src/comment/like.rs @@ -72,8 +72,7 @@ impl Perform for CreateCommentLike { // Only add the like if the score isnt 0 let do_add = like_form.score != 0 && (like_form.score == 1 || like_form.score == -1); if do_add { - let like_form2 = like_form.clone(); - CommentLike::like(context.pool(), &like_form2) + CommentLike::like(context.pool(), &like_form) .await .map_err(|e| LemmyError::from_error_message(e, "couldnt_like_comment"))?; } diff --git a/crates/api/src/post/like.rs b/crates/api/src/post/like.rs index 53e6c13c..9fa480a5 100644 --- a/crates/api/src/post/like.rs +++ b/crates/api/src/post/like.rs @@ -60,8 +60,7 @@ impl Perform for CreatePostLike { // Only add the like if the score isnt 0 let do_add = like_form.score != 0 && (like_form.score == 1 || like_form.score == -1); if do_add { - let like_form2 = like_form.clone(); - PostLike::like(context.pool(), &like_form2) + PostLike::like(context.pool(), &like_form) .await .map_err(|e| LemmyError::from_error_message(e, "couldnt_like_post"))?; } diff --git a/crates/api_crud/src/comment/create.rs b/crates/api_crud/src/comment/create.rs index 511059ac..103c71ce 100644 --- a/crates/api_crud/src/comment/create.rs +++ b/crates/api_crud/src/comment/create.rs @@ -107,9 +107,8 @@ impl PerformCrud for CreateComment { .build(); // Create the comment - let comment_form2 = comment_form.clone(); let parent_path = parent_opt.clone().map(|t| t.path); - let inserted_comment = Comment::create(context.pool(), &comment_form2, parent_path.as_ref()) + let inserted_comment = Comment::create(context.pool(), &comment_form, parent_path.as_ref()) .await .map_err(|e| LemmyError::from_error_message(e, "couldnt_create_comment"))?;