mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-23 04:41:19 +00:00
Remove unnecessary clone (#2874)
Co-authored-by: KyP <phanky.vn@proton.me>
This commit is contained in:
parent
82d93da26b
commit
4a70502007
3 changed files with 3 additions and 6 deletions
|
@ -72,8 +72,7 @@ impl Perform for CreateCommentLike {
|
||||||
// Only add the like if the score isnt 0
|
// Only add the like if the score isnt 0
|
||||||
let do_add = like_form.score != 0 && (like_form.score == 1 || like_form.score == -1);
|
let do_add = like_form.score != 0 && (like_form.score == 1 || like_form.score == -1);
|
||||||
if do_add {
|
if do_add {
|
||||||
let like_form2 = like_form.clone();
|
CommentLike::like(context.pool(), &like_form)
|
||||||
CommentLike::like(context.pool(), &like_form2)
|
|
||||||
.await
|
.await
|
||||||
.map_err(|e| LemmyError::from_error_message(e, "couldnt_like_comment"))?;
|
.map_err(|e| LemmyError::from_error_message(e, "couldnt_like_comment"))?;
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,8 +60,7 @@ impl Perform for CreatePostLike {
|
||||||
// Only add the like if the score isnt 0
|
// Only add the like if the score isnt 0
|
||||||
let do_add = like_form.score != 0 && (like_form.score == 1 || like_form.score == -1);
|
let do_add = like_form.score != 0 && (like_form.score == 1 || like_form.score == -1);
|
||||||
if do_add {
|
if do_add {
|
||||||
let like_form2 = like_form.clone();
|
PostLike::like(context.pool(), &like_form)
|
||||||
PostLike::like(context.pool(), &like_form2)
|
|
||||||
.await
|
.await
|
||||||
.map_err(|e| LemmyError::from_error_message(e, "couldnt_like_post"))?;
|
.map_err(|e| LemmyError::from_error_message(e, "couldnt_like_post"))?;
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,9 +107,8 @@ impl PerformCrud for CreateComment {
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
// Create the comment
|
// Create the comment
|
||||||
let comment_form2 = comment_form.clone();
|
|
||||||
let parent_path = parent_opt.clone().map(|t| t.path);
|
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
|
.await
|
||||||
.map_err(|e| LemmyError::from_error_message(e, "couldnt_create_comment"))?;
|
.map_err(|e| LemmyError::from_error_message(e, "couldnt_create_comment"))?;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue