From 4a7050200700073f9c328f4aa7394c1968b9d120 Mon Sep 17 00:00:00 2001 From: phankydn <42137630+phankydn@users.noreply.github.com> Date: Wed, 24 May 2023 06:00:19 +0700 Subject: [PATCH] Remove unnecessary clone (#2874) Co-authored-by: KyP --- crates/api/src/comment/like.rs | 3 +-- crates/api/src/post/like.rs | 3 +-- crates/api_crud/src/comment/create.rs | 3 +-- 3 files changed, 3 insertions(+), 6 deletions(-) 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"))?; -- 2.44.1