Fixing clippy lints. (#1885)

* Fixing clippy lints.

* Revert object id display

* Trying to fix clippy again
This commit is contained in:
Dessalines 2021-11-09 13:16:37 -05:00 committed by GitHub
parent c03689ed4c
commit 76220a4523
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 22 additions and 22 deletions

View file

@ -194,7 +194,7 @@ impl Perform for CreateCommentLike {
// Only add the like if the score isnt 0
let comment = orig_comment.comment;
let object = PostOrComment::Comment(comment.into());
let object = PostOrComment::Comment(Box::new(comment.into()));
let do_add = like_form.score != 0 && (like_form.score == 1 || like_form.score == -1);
if do_add {
let like_form2 = like_form.clone();

View file

@ -73,7 +73,7 @@ impl Perform for CreatePostLike {
.await??;
let community_id = post.community_id;
let object = PostOrComment::Post(post);
let object = PostOrComment::Post(Box::new(post));
// Only add the like if the score isnt 0
let do_add = like_form.score != 0 && (like_form.score == 1 || like_form.score == -1);

View file

@ -154,7 +154,7 @@ impl PerformCrud for CreateComment {
context,
)
.await?;
let object = PostOrComment::Comment(apub_comment);
let object = PostOrComment::Comment(Box::new(apub_comment));
Vote::send(
&object,
&local_user_view.person.clone().into(),

View file

@ -146,7 +146,7 @@ impl PerformCrud for CreatePost {
context,
)
.await?;
let object = PostOrComment::Post(apub_post);
let object = PostOrComment::Post(Box::new(apub_post));
Vote::send(
&object,
&local_user_view.person.clone().into(),

View file

@ -53,9 +53,9 @@ pub async fn send_apub_remove(
}
pub enum DeletableObjects {
Community(ApubCommunity),
Comment(ApubComment),
Post(ApubPost),
Community(Box<ApubCommunity>),
Comment(Box<ApubComment>),
Post(Box<ApubPost>),
}
impl DeletableObjects {
@ -64,13 +64,13 @@ impl DeletableObjects {
context: &LemmyContext,
) -> Result<DeletableObjects, LemmyError> {
if let Some(c) = ApubCommunity::read_from_apub_id(ap_id.clone(), context).await? {
return Ok(DeletableObjects::Community(c));
return Ok(DeletableObjects::Community(Box::new(c)));
}
if let Some(p) = ApubPost::read_from_apub_id(ap_id.clone(), context).await? {
return Ok(DeletableObjects::Post(p));
return Ok(DeletableObjects::Post(Box::new(p)));
}
if let Some(c) = ApubComment::read_from_apub_id(ap_id.clone(), context).await? {
return Ok(DeletableObjects::Comment(c));
return Ok(DeletableObjects::Comment(Box::new(c)));
}
Err(diesel::NotFound.into())
}

View file

@ -35,7 +35,7 @@ use serde::{Deserialize, Serialize};
#[serde(untagged)]
#[activity_handler(LemmyContext)]
pub enum SharedInboxActivities {
GroupInboxActivities(GroupInboxActivities),
GroupInboxActivities(Box<GroupInboxActivities>),
// Note, pm activities need to be at the end, otherwise comments will end up here. We can probably
// avoid this problem by replacing createpm.object with our own struct, instead of NoteExt.
PersonInboxActivities(Box<PersonInboxActivities>),

View file

@ -11,8 +11,8 @@ use url::Url;
#[derive(Clone, Debug)]
pub enum PostOrComment {
Post(ApubPost),
Comment(ApubComment),
Post(Box<ApubPost>),
Comment(Box<ApubComment>),
}
#[derive(Deserialize)]
@ -39,10 +39,10 @@ impl ApubObject for PostOrComment {
) -> Result<Option<Self>, LemmyError> {
let post = ApubPost::read_from_apub_id(object_id.clone(), data).await?;
Ok(match post {
Some(o) => Some(PostOrComment::Post(o)),
Some(o) => Some(PostOrComment::Post(Box::new(o))),
None => ApubComment::read_from_apub_id(object_id, data)
.await?
.map(PostOrComment::Comment),
.map(|c| PostOrComment::Comment(Box::new(c))),
})
}
@ -79,12 +79,12 @@ impl ApubObject for PostOrComment {
request_counter: &mut i32,
) -> Result<Self, LemmyError> {
Ok(match apub {
PageOrNote::Page(p) => {
PostOrComment::Post(ApubPost::from_apub(p, context, request_counter).await?)
}
PageOrNote::Note(n) => {
PostOrComment::Comment(ApubComment::from_apub(n, context, request_counter).await?)
}
PageOrNote::Page(p) => PostOrComment::Post(Box::new(
ApubPost::from_apub(p, context, request_counter).await?,
)),
PageOrNote::Note(n) => PostOrComment::Comment(Box::new(
ApubComment::from_apub(n, context, request_counter).await?,
)),
})
}
}

View file

@ -49,7 +49,7 @@ pub async fn shared_inbox(
let activity = serde_json::from_str::<WithContext<SharedInboxActivities>>(&unparsed)?;
match activity.inner() {
SharedInboxActivities::GroupInboxActivities(g) => {
receive_group_inbox(g, activity_data, request, &context).await
receive_group_inbox(*g, activity_data, request, &context).await
}
SharedInboxActivities::PersonInboxActivities(p) => {
receive_person_inbox(*p, activity_data, request, &context).await