Fixing clippy lints. (#1885)
authorDessalines <dessalines@users.noreply.github.com>
Tue, 9 Nov 2021 18:16:37 +0000 (13:16 -0500)
committerGitHub <noreply@github.com>
Tue, 9 Nov 2021 18:16:37 +0000 (18:16 +0000)
* Fixing clippy lints.

* Revert object id display

* Trying to fix clippy again

crates/api/src/comment.rs
crates/api/src/post.rs
crates/api_crud/src/comment/create.rs
crates/api_crud/src/post/create.rs
crates/apub/src/activities/deletion/mod.rs
crates/apub/src/activity_lists.rs
crates/apub/src/fetcher/post_or_comment.rs
crates/apub/src/http/mod.rs

index e6eef2cba3c81e3f50f191d66b3cbe2e3a96c730..e673d49798ce63d0aa8573100f2d9a31320bafb8 100644 (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();
index f22104eb7835b4e67115306b9ffd01352c5d3836..c7acb08fb30da67a2e7e948214ddabe250b3a733 100644 (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);
index 4c7bb34f037c8190165f90924062ea2624344e21..1c133be234a9de3901a699c843ddea0b286214e1 100644 (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(),
index 1147c1a32bb022bc213e0eb6673e556b5b5a9ae4..248adee6ce5bc5d6762067b07aa0bfeb00816c54 100644 (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(),
index 1d5a3836fdbb0724fe459445a85c7c852b22266c..ddd607a7c1128618f37b8abd79ec585367a140fb 100644 (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())
   }
index 2b695111f2f56327aa24a0227d03a64a9d3048e8..98736ae2fee036ac54c8997e7b41885a5bc383e8 100644 (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>),
index 2ca84bee14e9549b9eea13a8bc759e9bfafebefd..55d4948117c6fd7dabb45fd8c01b3c19212950ae 100644 (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?,
+      )),
     })
   }
 }
index b3288b0d9a894419c3e646838b4cefc7d85f137b..0fd8de8bde9a18b120f40126c62a242ebc03d4a3 100644 (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