Clippy fixes for 1.77.0 nightly (#4395)

* A few 1.77.0-nightly clippy fixes.

* Dead code warnings.

* More fixes.
This commit is contained in:
Dessalines 2024-01-24 04:34:09 -05:00 committed by GitHub
parent eb56d9253c
commit 20fd4b5869
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 14 additions and 21 deletions

View file

@ -53,7 +53,8 @@ pub async fn search(
data.community_id data.community_id
}; };
let creator_id = data.creator_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 { match search_type {
SearchType::Posts => { SearchType::Posts => {
posts = PostQuery { posts = PostQuery {
@ -90,7 +91,7 @@ pub async fn search(
sort: (sort), sort: (sort),
listing_type: (listing_type), listing_type: (listing_type),
search_term: (Some(q)), search_term: (Some(q)),
local_user: (local_user.as_ref()), local_user,
is_mod_or_admin: (is_admin), is_mod_or_admin: (is_admin),
page: (page), page: (page),
limit: (limit), limit: (limit),
@ -155,7 +156,7 @@ pub async fn search(
sort: (sort), sort: (sort),
listing_type: (listing_type), listing_type: (listing_type),
search_term: (Some(q)), search_term: (Some(q)),
local_user: (local_user.as_ref()), local_user,
is_mod_or_admin: (is_admin), is_mod_or_admin: (is_admin),
page: (page), page: (page),
limit: (limit), limit: (limit),

View file

@ -106,10 +106,10 @@ pub async fn import_settings(
let local_user_form = LocalUserUpdateForm { let local_user_form = LocalUserUpdateForm {
show_nsfw: data.settings.as_ref().map(|s| s.show_nsfw), 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_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), 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), show_avatars: data.settings.as_ref().map(|s| s.show_avatars),
send_notifications_to_email: data send_notifications_to_email: data
.settings .settings

View file

@ -15,7 +15,7 @@ use lemmy_utils::error::LemmyError;
use url::Url; use url::Url;
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub(crate) struct ApubCommunityFeatured(Vec<ApubPost>); pub(crate) struct ApubCommunityFeatured(());
#[async_trait::async_trait] #[async_trait::async_trait]
impl Collection for ApubCommunityFeatured { impl Collection for ApubCommunityFeatured {
@ -86,6 +86,6 @@ impl Collection for ApubCommunityFeatured {
.await; .await;
// This return value is unused, so just set an empty vec // This return value is unused, so just set an empty vec
Ok(ApubCommunityFeatured(Vec::new())) Ok(ApubCommunityFeatured(()))
} }
} }

View file

@ -15,7 +15,7 @@ use lemmy_utils::error::LemmyError;
use url::Url; use url::Url;
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub(crate) struct ApubCommunityFollower(Vec<()>); pub(crate) struct ApubCommunityFollower(());
#[async_trait::async_trait] #[async_trait::async_trait]
impl Collection for ApubCommunityFollower { impl Collection for ApubCommunityFollower {
@ -61,6 +61,6 @@ impl Collection for ApubCommunityFollower {
) )
.await?; .await?;
Ok(ApubCommunityFollower(Vec::new())) Ok(ApubCommunityFollower(()))
} }
} }

View file

@ -19,7 +19,7 @@ use lemmy_utils::error::LemmyError;
use url::Url; use url::Url;
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub(crate) struct ApubCommunityModerators(pub(crate) Vec<CommunityModeratorView>); pub(crate) struct ApubCommunityModerators(());
#[async_trait::async_trait] #[async_trait::async_trait]
impl Collection for ApubCommunityModerators { impl Collection for ApubCommunityModerators {
@ -96,7 +96,7 @@ impl Collection for ApubCommunityModerators {
} }
// This return value is unused, so just set an empty vec // This return value is unused, so just set an empty vec
Ok(ApubCommunityModerators(Vec::new())) Ok(ApubCommunityModerators(()))
} }
} }

View file

@ -27,7 +27,7 @@ use lemmy_utils::error::LemmyError;
use url::Url; use url::Url;
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub(crate) struct ApubCommunityOutbox(Vec<ApubPost>); pub(crate) struct ApubCommunityOutbox(());
#[async_trait::async_trait] #[async_trait::async_trait]
impl Collection for ApubCommunityOutbox { impl Collection for ApubCommunityOutbox {
@ -111,6 +111,6 @@ impl Collection for ApubCommunityOutbox {
.await; .await;
// This return value is unused, so just set an empty vec // This return value is unused, so just set an empty vec
Ok(ApubCommunityOutbox(Vec::new())) Ok(ApubCommunityOutbox(()))
} }
} }

View file

@ -58,14 +58,6 @@ struct PictrsParams {
thumbnail: Option<i32>, thumbnail: Option<i32>,
} }
#[derive(Deserialize)]
enum PictrsPurgeParams {
#[serde(rename = "file")]
File(String),
#[serde(rename = "alias")]
Alias(String),
}
fn adapt_request( fn adapt_request(
request: &HttpRequest, request: &HttpRequest,
client: &ClientWithMiddleware, client: &ClientWithMiddleware,