Remove unnecessary clone (#2874)

Co-authored-by: KyP <phanky.vn@proton.me>
handle-invalid-auth
phankydn 2023-05-24 06:00:19 +07:00 committed by GitHub
parent 82d93da26b
commit 4a70502007
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 6 deletions

View File

@ -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"))?;
}

View File

@ -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"))?;
}

View File

@ -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"))?;