From 20fd4b5869f9424249619afabeb5e0f4046eaba1 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Wed, 24 Jan 2024 04:34:09 -0500 Subject: [PATCH] Clippy fixes for 1.77.0 nightly (#4395) * A few 1.77.0-nightly clippy fixes. * Dead code warnings. * More fixes. --- crates/apub/src/api/search.rs | 7 ++++--- crates/apub/src/api/user_settings_backup.rs | 4 ++-- crates/apub/src/collections/community_featured.rs | 4 ++-- crates/apub/src/collections/community_follower.rs | 4 ++-- crates/apub/src/collections/community_moderators.rs | 4 ++-- crates/apub/src/collections/community_outbox.rs | 4 ++-- crates/routes/src/images.rs | 8 -------- 7 files changed, 14 insertions(+), 21 deletions(-) diff --git a/crates/apub/src/api/search.rs b/crates/apub/src/api/search.rs index b854a91d1..96ff97f70 100644 --- a/crates/apub/src/api/search.rs +++ b/crates/apub/src/api/search.rs @@ -53,7 +53,8 @@ pub async fn search( data.community_id }; let creator_id = data.creator_id; - let local_user = local_user_view.as_ref().map(|l| l.local_user.clone()); + let local_user = local_user_view.as_ref().map(|luv| &luv.local_user); + match search_type { SearchType::Posts => { posts = PostQuery { @@ -90,7 +91,7 @@ pub async fn search( sort: (sort), listing_type: (listing_type), search_term: (Some(q)), - local_user: (local_user.as_ref()), + local_user, is_mod_or_admin: (is_admin), page: (page), limit: (limit), @@ -155,7 +156,7 @@ pub async fn search( sort: (sort), listing_type: (listing_type), search_term: (Some(q)), - local_user: (local_user.as_ref()), + local_user, is_mod_or_admin: (is_admin), page: (page), limit: (limit), diff --git a/crates/apub/src/api/user_settings_backup.rs b/crates/apub/src/api/user_settings_backup.rs index bbc71b52a..e42e74d30 100644 --- a/crates/apub/src/api/user_settings_backup.rs +++ b/crates/apub/src/api/user_settings_backup.rs @@ -106,10 +106,10 @@ pub async fn import_settings( let local_user_form = LocalUserUpdateForm { show_nsfw: data.settings.as_ref().map(|s| s.show_nsfw), - theme: data.settings.as_ref().map(|s| s.theme.clone()), + theme: data.settings.clone().map(|s| s.theme.clone()), default_sort_type: data.settings.as_ref().map(|s| s.default_sort_type), default_listing_type: data.settings.as_ref().map(|s| s.default_listing_type), - interface_language: data.settings.as_ref().map(|s| s.interface_language.clone()), + interface_language: data.settings.clone().map(|s| s.interface_language), show_avatars: data.settings.as_ref().map(|s| s.show_avatars), send_notifications_to_email: data .settings diff --git a/crates/apub/src/collections/community_featured.rs b/crates/apub/src/collections/community_featured.rs index b3ee54db6..b106e3d9a 100644 --- a/crates/apub/src/collections/community_featured.rs +++ b/crates/apub/src/collections/community_featured.rs @@ -15,7 +15,7 @@ use lemmy_utils::error::LemmyError; use url::Url; #[derive(Clone, Debug)] -pub(crate) struct ApubCommunityFeatured(Vec); +pub(crate) struct ApubCommunityFeatured(()); #[async_trait::async_trait] impl Collection for ApubCommunityFeatured { @@ -86,6 +86,6 @@ impl Collection for ApubCommunityFeatured { .await; // This return value is unused, so just set an empty vec - Ok(ApubCommunityFeatured(Vec::new())) + Ok(ApubCommunityFeatured(())) } } diff --git a/crates/apub/src/collections/community_follower.rs b/crates/apub/src/collections/community_follower.rs index da0e52069..a4f5debbc 100644 --- a/crates/apub/src/collections/community_follower.rs +++ b/crates/apub/src/collections/community_follower.rs @@ -15,7 +15,7 @@ use lemmy_utils::error::LemmyError; use url::Url; #[derive(Clone, Debug)] -pub(crate) struct ApubCommunityFollower(Vec<()>); +pub(crate) struct ApubCommunityFollower(()); #[async_trait::async_trait] impl Collection for ApubCommunityFollower { @@ -61,6 +61,6 @@ impl Collection for ApubCommunityFollower { ) .await?; - Ok(ApubCommunityFollower(Vec::new())) + Ok(ApubCommunityFollower(())) } } diff --git a/crates/apub/src/collections/community_moderators.rs b/crates/apub/src/collections/community_moderators.rs index fc4d09a02..4ad499ea2 100644 --- a/crates/apub/src/collections/community_moderators.rs +++ b/crates/apub/src/collections/community_moderators.rs @@ -19,7 +19,7 @@ use lemmy_utils::error::LemmyError; use url::Url; #[derive(Clone, Debug)] -pub(crate) struct ApubCommunityModerators(pub(crate) Vec); +pub(crate) struct ApubCommunityModerators(()); #[async_trait::async_trait] impl Collection for ApubCommunityModerators { @@ -96,7 +96,7 @@ impl Collection for ApubCommunityModerators { } // This return value is unused, so just set an empty vec - Ok(ApubCommunityModerators(Vec::new())) + Ok(ApubCommunityModerators(())) } } diff --git a/crates/apub/src/collections/community_outbox.rs b/crates/apub/src/collections/community_outbox.rs index 8e319403d..0799db789 100644 --- a/crates/apub/src/collections/community_outbox.rs +++ b/crates/apub/src/collections/community_outbox.rs @@ -27,7 +27,7 @@ use lemmy_utils::error::LemmyError; use url::Url; #[derive(Clone, Debug)] -pub(crate) struct ApubCommunityOutbox(Vec); +pub(crate) struct ApubCommunityOutbox(()); #[async_trait::async_trait] impl Collection for ApubCommunityOutbox { @@ -111,6 +111,6 @@ impl Collection for ApubCommunityOutbox { .await; // This return value is unused, so just set an empty vec - Ok(ApubCommunityOutbox(Vec::new())) + Ok(ApubCommunityOutbox(())) } } diff --git a/crates/routes/src/images.rs b/crates/routes/src/images.rs index 6b5d9d958..16b388ca6 100644 --- a/crates/routes/src/images.rs +++ b/crates/routes/src/images.rs @@ -58,14 +58,6 @@ struct PictrsParams { thumbnail: Option, } -#[derive(Deserialize)] -enum PictrsPurgeParams { - #[serde(rename = "file")] - File(String), - #[serde(rename = "alias")] - Alias(String), -} - fn adapt_request( request: &HttpRequest, client: &ClientWithMiddleware,