From 322ccfe695f5bf4446b88e1b8306d193283fe4c4 Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Tue, 24 Sep 2024 12:07:28 +0200 Subject: [PATCH] Replace clippy allow annotation with expect (fixes #5012) --- crates/api/src/lib.rs | 4 ++-- crates/api/src/site/registration_applications/tests.rs | 8 ++++---- crates/api/src/sitemap.rs | 2 +- crates/api_common/src/claims.rs | 4 ++-- crates/api_common/src/request.rs | 4 ++-- crates/api_common/src/utils.rs | 4 ++-- crates/api_crud/src/site/create.rs | 4 ++-- crates/api_crud/src/site/mod.rs | 4 ++-- crates/api_crud/src/site/update.rs | 4 ++-- crates/apub/src/activity_lists.rs | 2 +- crates/apub/src/api/user_settings_backup.rs | 2 +- crates/apub/src/collections/community_moderators.rs | 2 +- crates/apub/src/http/community.rs | 4 ++-- crates/db_perf/src/series.rs | 2 +- crates/db_schema/src/aggregates/comment_aggregates.rs | 4 ++-- crates/db_schema/src/aggregates/community_aggregates.rs | 4 ++-- crates/db_schema/src/aggregates/person_aggregates.rs | 4 ++-- crates/db_schema/src/aggregates/post_aggregates.rs | 4 ++-- crates/db_schema/src/aggregates/site_aggregates.rs | 4 ++-- crates/db_schema/src/impls/activity.rs | 4 ++-- crates/db_schema/src/impls/actor_language.rs | 4 ++-- crates/db_schema/src/impls/captcha_answer.rs | 4 ++-- crates/db_schema/src/impls/comment.rs | 4 ++-- crates/db_schema/src/impls/community.rs | 2 +- crates/db_schema/src/impls/federation_allowlist.rs | 4 ++-- crates/db_schema/src/impls/language.rs | 4 ++-- crates/db_schema/src/impls/local_user.rs | 2 +- crates/db_schema/src/impls/moderator.rs | 4 ++-- crates/db_schema/src/impls/password_reset_request.rs | 4 ++-- crates/db_schema/src/impls/person.rs | 2 +- crates/db_schema/src/impls/post.rs | 4 ++-- crates/db_schema/src/impls/post_report.rs | 4 ++-- crates/db_schema/src/impls/private_message.rs | 4 ++-- crates/db_schema/src/lib.rs | 2 +- crates/db_schema/src/newtypes.rs | 4 ++-- crates/db_schema/src/utils.rs | 2 +- crates/db_views/src/comment_report_view.rs | 4 ++-- crates/db_views/src/comment_view.rs | 4 ++-- crates/db_views/src/post_report_view.rs | 4 ++-- crates/db_views/src/post_view.rs | 2 +- crates/db_views/src/private_message_report_view.rs | 4 ++-- crates/db_views/src/private_message_view.rs | 4 ++-- crates/db_views/src/registration_application_view.rs | 4 ++-- crates/db_views/src/vote_view.rs | 4 ++-- crates/db_views_actor/src/comment_reply_view.rs | 2 +- crates/db_views_actor/src/community_view.rs | 4 ++-- crates/db_views_actor/src/person_mention_view.rs | 2 +- crates/db_views_actor/src/person_view.rs | 2 +- crates/federate/src/inboxes.rs | 4 ++-- crates/federate/src/lib.rs | 4 ++-- crates/federate/src/worker.rs | 4 ++-- crates/utils/src/rate_limit/mod.rs | 2 -- crates/utils/src/rate_limit/rate_limiter.rs | 7 +------ crates/utils/src/utils/markdown/mod.rs | 3 +-- crates/utils/src/utils/markdown/spoiler_rule.rs | 2 -- crates/utils/src/utils/mention.rs | 3 +-- crates/utils/src/utils/slurs.rs | 3 +-- crates/utils/src/utils/validation.rs | 1 - src/scheduled_tasks.rs | 2 +- src/session_middleware.rs | 4 ++-- 60 files changed, 97 insertions(+), 110 deletions(-) diff --git a/crates/api/src/lib.rs b/crates/api/src/lib.rs index 44a8d9bbc0..1ce15b6ed2 100644 --- a/crates/api/src/lib.rs +++ b/crates/api/src/lib.rs @@ -265,8 +265,8 @@ pub async fn local_user_view_from_jwt( } #[cfg(test)] -#[allow(clippy::unwrap_used)] -#[allow(clippy::indexing_slicing)] +#[expect(clippy::unwrap_used)] +#[expect(clippy::indexing_slicing)] mod tests { use super::*; diff --git a/crates/api/src/site/registration_applications/tests.rs b/crates/api/src/site/registration_applications/tests.rs index 30cbdde729..59b616b7c7 100644 --- a/crates/api/src/site/registration_applications/tests.rs +++ b/crates/api/src/site/registration_applications/tests.rs @@ -34,7 +34,7 @@ use lemmy_db_views::structs::LocalUserView; use lemmy_utils::{error::LemmyResult, LemmyErrorType, CACHE_DURATION_API}; use serial_test::serial; -#[allow(clippy::unwrap_used)] +#[expect(clippy::unwrap_used)] async fn create_test_site(context: &Data) -> LemmyResult<(Instance, LocalUserView)> { let pool = &mut context.pool(); @@ -109,7 +109,7 @@ async fn signup( Ok((local_user, application)) } -#[allow(clippy::unwrap_used)] +#[expect(clippy::unwrap_used)] async fn get_application_statuses( context: &Data, admin: LocalUserView, @@ -138,8 +138,8 @@ async fn get_application_statuses( Ok((application_count, unread_applications, all_applications)) } -#[allow(clippy::indexing_slicing)] -#[allow(clippy::unwrap_used)] +#[expect(clippy::indexing_slicing)] +#[expect(clippy::unwrap_used)] #[tokio::test] #[serial] async fn test_application_approval() -> LemmyResult<()> { diff --git a/crates/api/src/sitemap.rs b/crates/api/src/sitemap.rs index bd0e0dad89..2d06a12497 100644 --- a/crates/api/src/sitemap.rs +++ b/crates/api/src/sitemap.rs @@ -42,7 +42,7 @@ pub async fn get_sitemap(context: Data) -> LemmyResult } #[cfg(test)] -#[allow(clippy::unwrap_used)] -#[allow(clippy::indexing_slicing)] +#[expect(clippy::unwrap_used)] +#[expect(clippy::indexing_slicing)] mod tests { use crate::site::create::validate_create_payload; diff --git a/crates/api_crud/src/site/mod.rs b/crates/api_crud/src/site/mod.rs index 462d2f072c..06d078a22a 100644 --- a/crates/api_crud/src/site/mod.rs +++ b/crates/api_crud/src/site/mod.rs @@ -48,8 +48,8 @@ fn not_zero(val: Option) -> Option { } #[cfg(test)] -#[allow(clippy::unwrap_used)] -#[allow(clippy::indexing_slicing)] +#[expect(clippy::unwrap_used)] +#[expect(clippy::indexing_slicing)] mod tests { use crate::site::{application_question_check, not_zero, site_default_post_listing_type_check}; diff --git a/crates/api_crud/src/site/update.rs b/crates/api_crud/src/site/update.rs index daa0bc49e1..8d0556c378 100644 --- a/crates/api_crud/src/site/update.rs +++ b/crates/api_crud/src/site/update.rs @@ -241,8 +241,8 @@ fn validate_update_payload(local_site: &LocalSite, edit_site: &EditSite) -> Lemm } #[cfg(test)] -#[allow(clippy::unwrap_used)] -#[allow(clippy::indexing_slicing)] +#[expect(clippy::unwrap_used)] +#[expect(clippy::indexing_slicing)] mod tests { use crate::site::update::validate_update_payload; diff --git a/crates/apub/src/activity_lists.rs b/crates/apub/src/activity_lists.rs index e895ad1cc3..ec96940c7a 100644 --- a/crates/apub/src/activity_lists.rs +++ b/crates/apub/src/activity_lists.rs @@ -123,7 +123,7 @@ impl InCommunity for AnnouncableActivities { } #[cfg(test)] -#[allow(clippy::indexing_slicing)] +#[expect(clippy::indexing_slicing)] mod tests { use crate::{ diff --git a/crates/apub/src/api/user_settings_backup.rs b/crates/apub/src/api/user_settings_backup.rs index 6764f62cbd..9bb91dcf6e 100644 --- a/crates/apub/src/api/user_settings_backup.rs +++ b/crates/apub/src/api/user_settings_backup.rs @@ -309,7 +309,7 @@ where Ok(failed_items.into_iter().join(",")) } #[cfg(test)] -#[allow(clippy::indexing_slicing)] +#[expect(clippy::indexing_slicing)] mod tests { use crate::api::user_settings_backup::{export_settings, import_settings, UserSettingsBackup}; diff --git a/crates/apub/src/collections/community_moderators.rs b/crates/apub/src/collections/community_moderators.rs index 8e5419c7e2..c7b925f97a 100644 --- a/crates/apub/src/collections/community_moderators.rs +++ b/crates/apub/src/collections/community_moderators.rs @@ -98,7 +98,7 @@ impl Collection for ApubCommunityModerators { } #[cfg(test)] -#[allow(clippy::indexing_slicing)] +#[expect(clippy::indexing_slicing)] mod tests { use super::*; diff --git a/crates/apub/src/http/community.rs b/crates/apub/src/http/community.rs index 53d25be626..db992d6260 100644 --- a/crates/apub/src/http/community.rs +++ b/crates/apub/src/http/community.rs @@ -120,8 +120,8 @@ pub(crate) async fn get_apub_community_featured( } #[cfg(test)] -#[allow(clippy::unwrap_used)] -#[allow(clippy::indexing_slicing)] +#[expect(clippy::unwrap_used)] +#[expect(clippy::indexing_slicing)] pub(crate) mod tests { use super::*; diff --git a/crates/db_perf/src/series.rs b/crates/db_perf/src/series.rs index b504efc541..8efc078b19 100644 --- a/crates/db_perf/src/series.rs +++ b/crates/db_perf/src/series.rs @@ -75,7 +75,7 @@ impl> ValidGrouping<()> type IsAggregate = is_aggregate::No; } -#[allow(non_camel_case_types)] +#[expect(non_camel_case_types)] #[derive(QueryId, Clone, Copy, Debug)] pub struct current_value; diff --git a/crates/db_schema/src/aggregates/comment_aggregates.rs b/crates/db_schema/src/aggregates/comment_aggregates.rs index 1508997638..7b2a942f6e 100644 --- a/crates/db_schema/src/aggregates/comment_aggregates.rs +++ b/crates/db_schema/src/aggregates/comment_aggregates.rs @@ -30,8 +30,8 @@ impl CommentAggregates { } #[cfg(test)] -#[allow(clippy::unwrap_used)] -#[allow(clippy::indexing_slicing)] +#[expect(clippy::unwrap_used)] +#[expect(clippy::indexing_slicing)] mod tests { use crate::{ diff --git a/crates/db_schema/src/aggregates/community_aggregates.rs b/crates/db_schema/src/aggregates/community_aggregates.rs index 1e52052f6d..29ccff398a 100644 --- a/crates/db_schema/src/aggregates/community_aggregates.rs +++ b/crates/db_schema/src/aggregates/community_aggregates.rs @@ -36,8 +36,8 @@ impl CommunityAggregates { } #[cfg(test)] -#[allow(clippy::unwrap_used)] -#[allow(clippy::indexing_slicing)] +#[expect(clippy::unwrap_used)] +#[expect(clippy::indexing_slicing)] mod tests { use crate::{ diff --git a/crates/db_schema/src/aggregates/person_aggregates.rs b/crates/db_schema/src/aggregates/person_aggregates.rs index 337af5ef3c..03d396adb6 100644 --- a/crates/db_schema/src/aggregates/person_aggregates.rs +++ b/crates/db_schema/src/aggregates/person_aggregates.rs @@ -20,8 +20,8 @@ impl PersonAggregates { } #[cfg(test)] -#[allow(clippy::unwrap_used)] -#[allow(clippy::indexing_slicing)] +#[expect(clippy::unwrap_used)] +#[expect(clippy::indexing_slicing)] mod tests { use crate::{ diff --git a/crates/db_schema/src/aggregates/post_aggregates.rs b/crates/db_schema/src/aggregates/post_aggregates.rs index f15567d8fc..bdddbd391a 100644 --- a/crates/db_schema/src/aggregates/post_aggregates.rs +++ b/crates/db_schema/src/aggregates/post_aggregates.rs @@ -49,8 +49,8 @@ impl PostAggregates { } #[cfg(test)] -#[allow(clippy::unwrap_used)] -#[allow(clippy::indexing_slicing)] +#[expect(clippy::unwrap_used)] +#[expect(clippy::indexing_slicing)] mod tests { use crate::{ diff --git a/crates/db_schema/src/aggregates/site_aggregates.rs b/crates/db_schema/src/aggregates/site_aggregates.rs index 81d6b559d3..8c6e43134b 100644 --- a/crates/db_schema/src/aggregates/site_aggregates.rs +++ b/crates/db_schema/src/aggregates/site_aggregates.rs @@ -15,8 +15,8 @@ impl SiteAggregates { } #[cfg(test)] -#[allow(clippy::unwrap_used)] -#[allow(clippy::indexing_slicing)] +#[expect(clippy::unwrap_used)] +#[expect(clippy::indexing_slicing)] mod tests { use crate::{ diff --git a/crates/db_schema/src/impls/activity.rs b/crates/db_schema/src/impls/activity.rs index 6b057d2540..240978568b 100644 --- a/crates/db_schema/src/impls/activity.rs +++ b/crates/db_schema/src/impls/activity.rs @@ -58,8 +58,8 @@ impl ReceivedActivity { } #[cfg(test)] -#[allow(clippy::unwrap_used)] -#[allow(clippy::indexing_slicing)] +#[expect(clippy::unwrap_used)] +#[expect(clippy::indexing_slicing)] mod tests { use super::*; diff --git a/crates/db_schema/src/impls/actor_language.rs b/crates/db_schema/src/impls/actor_language.rs index 958c5b1e66..35926de23d 100644 --- a/crates/db_schema/src/impls/actor_language.rs +++ b/crates/db_schema/src/impls/actor_language.rs @@ -392,8 +392,8 @@ async fn convert_read_languages( } #[cfg(test)] -#[allow(clippy::unwrap_used)] -#[allow(clippy::indexing_slicing)] +#[expect(clippy::unwrap_used)] +#[expect(clippy::indexing_slicing)] mod tests { use super::*; diff --git a/crates/db_schema/src/impls/captcha_answer.rs b/crates/db_schema/src/impls/captcha_answer.rs index 976d89515b..1b5305d0ca 100644 --- a/crates/db_schema/src/impls/captcha_answer.rs +++ b/crates/db_schema/src/impls/captcha_answer.rs @@ -51,8 +51,8 @@ impl CaptchaAnswer { } #[cfg(test)] -#[allow(clippy::unwrap_used)] -#[allow(clippy::indexing_slicing)] +#[expect(clippy::unwrap_used)] +#[expect(clippy::indexing_slicing)] mod tests { use crate::{ diff --git a/crates/db_schema/src/impls/comment.rs b/crates/db_schema/src/impls/comment.rs index 0a4d7dd0e1..003c0eda91 100644 --- a/crates/db_schema/src/impls/comment.rs +++ b/crates/db_schema/src/impls/comment.rs @@ -196,8 +196,8 @@ impl Saveable for CommentSaved { } #[cfg(test)] -#[allow(clippy::unwrap_used)] -#[allow(clippy::indexing_slicing)] +#[expect(clippy::unwrap_used)] +#[expect(clippy::indexing_slicing)] mod tests { use crate::{ diff --git a/crates/db_schema/src/impls/community.rs b/crates/db_schema/src/impls/community.rs index f106ca4243..2c26a6acfb 100644 --- a/crates/db_schema/src/impls/community.rs +++ b/crates/db_schema/src/impls/community.rs @@ -431,7 +431,7 @@ impl ApubActor for Community { } #[cfg(test)] -#[allow(clippy::indexing_slicing)] +#[expect(clippy::indexing_slicing)] mod tests { use crate::{ source::{ diff --git a/crates/db_schema/src/impls/federation_allowlist.rs b/crates/db_schema/src/impls/federation_allowlist.rs index 80408a526d..50f9a0d5c1 100644 --- a/crates/db_schema/src/impls/federation_allowlist.rs +++ b/crates/db_schema/src/impls/federation_allowlist.rs @@ -48,8 +48,8 @@ impl FederationAllowList { } } #[cfg(test)] -#[allow(clippy::unwrap_used)] -#[allow(clippy::indexing_slicing)] +#[expect(clippy::unwrap_used)] +#[expect(clippy::indexing_slicing)] mod tests { use crate::{ diff --git a/crates/db_schema/src/impls/language.rs b/crates/db_schema/src/impls/language.rs index 6a7b4e9ac4..96992a6140 100644 --- a/crates/db_schema/src/impls/language.rs +++ b/crates/db_schema/src/impls/language.rs @@ -41,8 +41,8 @@ impl Language { } #[cfg(test)] -#[allow(clippy::unwrap_used)] -#[allow(clippy::indexing_slicing)] +#[expect(clippy::unwrap_used)] +#[expect(clippy::indexing_slicing)] mod tests { use crate::{source::language::Language, utils::build_db_pool_for_tests}; diff --git a/crates/db_schema/src/impls/local_user.rs b/crates/db_schema/src/impls/local_user.rs index a06f22e349..72c9578b5c 100644 --- a/crates/db_schema/src/impls/local_user.rs +++ b/crates/db_schema/src/impls/local_user.rs @@ -369,7 +369,7 @@ pub struct UserBackupLists { } #[cfg(test)] -#[allow(clippy::indexing_slicing)] +#[expect(clippy::indexing_slicing)] mod tests { use crate::{ source::{ diff --git a/crates/db_schema/src/impls/moderator.rs b/crates/db_schema/src/impls/moderator.rs index 14964aa007..13145bcfee 100644 --- a/crates/db_schema/src/impls/moderator.rs +++ b/crates/db_schema/src/impls/moderator.rs @@ -465,8 +465,8 @@ impl Crud for AdminPurgeComment { } #[cfg(test)] -#[allow(clippy::unwrap_used)] -#[allow(clippy::indexing_slicing)] +#[expect(clippy::unwrap_used)] +#[expect(clippy::indexing_slicing)] mod tests { use crate::{ diff --git a/crates/db_schema/src/impls/password_reset_request.rs b/crates/db_schema/src/impls/password_reset_request.rs index 8ce7640a5d..732f14c924 100644 --- a/crates/db_schema/src/impls/password_reset_request.rs +++ b/crates/db_schema/src/impls/password_reset_request.rs @@ -42,8 +42,8 @@ impl PasswordResetRequest { } #[cfg(test)] -#[allow(clippy::unwrap_used)] -#[allow(clippy::indexing_slicing)] +#[expect(clippy::unwrap_used)] +#[expect(clippy::indexing_slicing)] mod tests { use crate::{ diff --git a/crates/db_schema/src/impls/person.rs b/crates/db_schema/src/impls/person.rs index 0a0a2b7a20..c8f45ecf04 100644 --- a/crates/db_schema/src/impls/person.rs +++ b/crates/db_schema/src/impls/person.rs @@ -232,7 +232,7 @@ impl PersonFollower { } #[cfg(test)] -#[allow(clippy::indexing_slicing)] +#[expect(clippy::indexing_slicing)] mod tests { use crate::{ diff --git a/crates/db_schema/src/impls/post.rs b/crates/db_schema/src/impls/post.rs index 6a89dd577e..21c053c56f 100644 --- a/crates/db_schema/src/impls/post.rs +++ b/crates/db_schema/src/impls/post.rs @@ -392,8 +392,8 @@ impl PostHide { } #[cfg(test)] -#[allow(clippy::unwrap_used)] -#[allow(clippy::indexing_slicing)] +#[expect(clippy::unwrap_used)] +#[expect(clippy::indexing_slicing)] mod tests { use crate::{ diff --git a/crates/db_schema/src/impls/post_report.rs b/crates/db_schema/src/impls/post_report.rs index ccb2f83fb0..e339eb4c6f 100644 --- a/crates/db_schema/src/impls/post_report.rs +++ b/crates/db_schema/src/impls/post_report.rs @@ -80,8 +80,8 @@ impl Reportable for PostReport { } #[cfg(test)] -#[allow(clippy::unwrap_used)] -#[allow(clippy::indexing_slicing)] +#[expect(clippy::unwrap_used)] +#[expect(clippy::indexing_slicing)] mod tests { use super::*; diff --git a/crates/db_schema/src/impls/private_message.rs b/crates/db_schema/src/impls/private_message.rs index d0ca7378ed..c4168b2120 100644 --- a/crates/db_schema/src/impls/private_message.rs +++ b/crates/db_schema/src/impls/private_message.rs @@ -85,8 +85,8 @@ impl PrivateMessage { } #[cfg(test)] -#[allow(clippy::unwrap_used)] -#[allow(clippy::indexing_slicing)] +#[expect(clippy::unwrap_used)] +#[expect(clippy::indexing_slicing)] mod tests { use crate::{ diff --git a/crates/db_schema/src/lib.rs b/crates/db_schema/src/lib.rs index 7c57ddf282..e8e6a2daf5 100644 --- a/crates/db_schema/src/lib.rs +++ b/crates/db_schema/src/lib.rs @@ -27,7 +27,7 @@ pub mod newtypes; pub mod sensitive; #[cfg(feature = "full")] #[rustfmt::skip] -#[allow(clippy::wildcard_imports)] +#[expect(clippy::wildcard_imports)] pub mod schema; #[cfg(feature = "full")] pub mod aliases { diff --git a/crates/db_schema/src/newtypes.rs b/crates/db_schema/src/newtypes.rs index 58396c66ae..fe1febef59 100644 --- a/crates/db_schema/src/newtypes.rs +++ b/crates/db_schema/src/newtypes.rs @@ -191,13 +191,13 @@ impl Display for DbUrl { } // the project doesn't compile with From -#[allow(clippy::from_over_into)] +#[expect(clippy::from_over_into)] impl Into for Url { fn into(self) -> DbUrl { DbUrl(Box::new(self)) } } -#[allow(clippy::from_over_into)] +#[expect(clippy::from_over_into)] impl Into for DbUrl { fn into(self) -> Url { *self.0 diff --git a/crates/db_schema/src/utils.rs b/crates/db_schema/src/utils.rs index fb9c542df9..8b70624854 100644 --- a/crates/db_schema/src/utils.rs +++ b/crates/db_schema/src/utils.rs @@ -595,7 +595,7 @@ impl Queries { } #[cfg(test)] -#[allow(clippy::indexing_slicing)] +#[expect(clippy::indexing_slicing)] mod tests { use super::*; diff --git a/crates/db_views/src/comment_report_view.rs b/crates/db_views/src/comment_report_view.rs index 42b5c32386..4955dabea9 100644 --- a/crates/db_views/src/comment_report_view.rs +++ b/crates/db_views/src/comment_report_view.rs @@ -259,8 +259,8 @@ impl CommentReportQuery { } #[cfg(test)] -#[allow(clippy::unwrap_used)] -#[allow(clippy::indexing_slicing)] +#[expect(clippy::unwrap_used)] +#[expect(clippy::indexing_slicing)] mod tests { use crate::{ diff --git a/crates/db_views/src/comment_view.rs b/crates/db_views/src/comment_view.rs index 7f3c853f19..626a56b16c 100644 --- a/crates/db_views/src/comment_view.rs +++ b/crates/db_views/src/comment_view.rs @@ -422,8 +422,8 @@ impl<'a> CommentQuery<'a> { } #[cfg(test)] -#[allow(clippy::indexing_slicing)] -#[allow(clippy::unwrap_used)] +#[expect(clippy::indexing_slicing)] +#[expect(clippy::unwrap_used)] mod tests { use crate::{ diff --git a/crates/db_views/src/post_report_view.rs b/crates/db_views/src/post_report_view.rs index 527ebdafab..fa99419900 100644 --- a/crates/db_views/src/post_report_view.rs +++ b/crates/db_views/src/post_report_view.rs @@ -284,8 +284,8 @@ impl PostReportQuery { } #[cfg(test)] -#[allow(clippy::unwrap_used)] -#[allow(clippy::indexing_slicing)] +#[expect(clippy::unwrap_used)] +#[expect(clippy::indexing_slicing)] mod tests { use crate::{ diff --git a/crates/db_views/src/post_view.rs b/crates/db_views/src/post_view.rs index a8d908c7d1..7946f282ce 100644 --- a/crates/db_views/src/post_view.rs +++ b/crates/db_views/src/post_view.rs @@ -741,7 +741,7 @@ impl<'a> PostQuery<'a> { } #[cfg(test)] -#[allow(clippy::unwrap_used)] +#[expect(clippy::unwrap_used)] mod tests { use crate::{ post_view::{PaginationCursorData, PostQuery, PostView}, diff --git a/crates/db_views/src/private_message_report_view.rs b/crates/db_views/src/private_message_report_view.rs index 49b8e415b9..c4bbf89acf 100644 --- a/crates/db_views/src/private_message_report_view.rs +++ b/crates/db_views/src/private_message_report_view.rs @@ -111,8 +111,8 @@ impl PrivateMessageReportQuery { } #[cfg(test)] -#[allow(clippy::unwrap_used)] -#[allow(clippy::indexing_slicing)] +#[expect(clippy::unwrap_used)] +#[expect(clippy::indexing_slicing)] mod tests { use crate::private_message_report_view::PrivateMessageReportQuery; diff --git a/crates/db_views/src/private_message_view.rs b/crates/db_views/src/private_message_view.rs index cd475897f0..cfac287d1c 100644 --- a/crates/db_views/src/private_message_view.rs +++ b/crates/db_views/src/private_message_view.rs @@ -173,8 +173,8 @@ impl PrivateMessageQuery { } #[cfg(test)] -#[allow(clippy::unwrap_used)] -#[allow(clippy::indexing_slicing)] +#[expect(clippy::unwrap_used)] +#[expect(clippy::indexing_slicing)] mod tests { use crate::{private_message_view::PrivateMessageQuery, structs::PrivateMessageView}; diff --git a/crates/db_views/src/registration_application_view.rs b/crates/db_views/src/registration_application_view.rs index ba44e927e0..3b6f93b471 100644 --- a/crates/db_views/src/registration_application_view.rs +++ b/crates/db_views/src/registration_application_view.rs @@ -135,8 +135,8 @@ impl RegistrationApplicationQuery { } #[cfg(test)] -#[allow(clippy::unwrap_used)] -#[allow(clippy::indexing_slicing)] +#[expect(clippy::unwrap_used)] +#[expect(clippy::indexing_slicing)] mod tests { use crate::registration_application_view::{ diff --git a/crates/db_views/src/vote_view.rs b/crates/db_views/src/vote_view.rs index c97f60e28a..2fa8a0927d 100644 --- a/crates/db_views/src/vote_view.rs +++ b/crates/db_views/src/vote_view.rs @@ -83,8 +83,8 @@ impl VoteView { } #[cfg(test)] -#[allow(clippy::unwrap_used)] -#[allow(clippy::indexing_slicing)] +#[expect(clippy::unwrap_used)] +#[expect(clippy::indexing_slicing)] mod tests { use crate::structs::VoteView; diff --git a/crates/db_views_actor/src/comment_reply_view.rs b/crates/db_views_actor/src/comment_reply_view.rs index 6f8810986c..7784c268d1 100644 --- a/crates/db_views_actor/src/comment_reply_view.rs +++ b/crates/db_views_actor/src/comment_reply_view.rs @@ -303,7 +303,7 @@ impl CommentReplyQuery { } #[cfg(test)] -#[allow(clippy::indexing_slicing)] +#[expect(clippy::indexing_slicing)] mod tests { use crate::{comment_reply_view::CommentReplyQuery, structs::CommentReplyView}; diff --git a/crates/db_views_actor/src/community_view.rs b/crates/db_views_actor/src/community_view.rs index a1b387beac..30f3cb43c8 100644 --- a/crates/db_views_actor/src/community_view.rs +++ b/crates/db_views_actor/src/community_view.rs @@ -242,8 +242,8 @@ impl<'a> CommunityQuery<'a> { } #[cfg(test)] -#[allow(clippy::unwrap_used)] -#[allow(clippy::indexing_slicing)] +#[expect(clippy::unwrap_used)] +#[expect(clippy::indexing_slicing)] mod tests { use crate::{community_view::CommunityQuery, structs::CommunityView}; diff --git a/crates/db_views_actor/src/person_mention_view.rs b/crates/db_views_actor/src/person_mention_view.rs index 102f95c876..5580408300 100644 --- a/crates/db_views_actor/src/person_mention_view.rs +++ b/crates/db_views_actor/src/person_mention_view.rs @@ -303,7 +303,7 @@ impl PersonMentionQuery { } #[cfg(test)] -#[allow(clippy::indexing_slicing)] +#[expect(clippy::indexing_slicing)] mod tests { use crate::{person_mention_view::PersonMentionQuery, structs::PersonMentionView}; diff --git a/crates/db_views_actor/src/person_view.rs b/crates/db_views_actor/src/person_view.rs index ff4a595fff..724a700ad0 100644 --- a/crates/db_views_actor/src/person_view.rs +++ b/crates/db_views_actor/src/person_view.rs @@ -164,7 +164,7 @@ impl PersonQuery { } #[cfg(test)] -#[allow(clippy::indexing_slicing)] +#[expect(clippy::indexing_slicing)] mod tests { use super::*; diff --git a/crates/federate/src/inboxes.rs b/crates/federate/src/inboxes.rs index cda4da39bc..d571499135 100644 --- a/crates/federate/src/inboxes.rs +++ b/crates/federate/src/inboxes.rs @@ -222,8 +222,8 @@ impl CommunityInboxCollector { } #[cfg(test)] -#[allow(clippy::unwrap_used)] -#[allow(clippy::indexing_slicing)] +#[expect(clippy::unwrap_used)] +#[expect(clippy::indexing_slicing)] mod tests { use super::*; use lemmy_db_schema::{ diff --git a/crates/federate/src/lib.rs b/crates/federate/src/lib.rs index 0e43ef0187..983749de35 100644 --- a/crates/federate/src/lib.rs +++ b/crates/federate/src/lib.rs @@ -192,8 +192,8 @@ impl SendManager { } #[cfg(test)] -#[allow(clippy::unwrap_used)] -#[allow(clippy::indexing_slicing)] +#[expect(clippy::unwrap_used)] +#[expect(clippy::indexing_slicing)] mod test { use super::*; diff --git a/crates/federate/src/worker.rs b/crates/federate/src/worker.rs index 56f42bb304..0d4ad04d59 100644 --- a/crates/federate/src/worker.rs +++ b/crates/federate/src/worker.rs @@ -439,8 +439,8 @@ impl InstanceWorker { } #[cfg(test)] -#[allow(clippy::unwrap_used)] -#[allow(clippy::indexing_slicing)] +#[expect(clippy::unwrap_used)] +#[expect(clippy::indexing_slicing)] mod test { use super::*; diff --git a/crates/utils/src/rate_limit/mod.rs b/crates/utils/src/rate_limit/mod.rs index de64bac462..a6cf921500 100644 --- a/crates/utils/src/rate_limit/mod.rs +++ b/crates/utils/src/rate_limit/mod.rs @@ -221,8 +221,6 @@ fn parse_ip(addr: &str) -> Option { } #[cfg(test)] -#[allow(clippy::unwrap_used)] -#[allow(clippy::indexing_slicing)] mod tests { #[test] diff --git a/crates/utils/src/rate_limit/rate_limiter.rs b/crates/utils/src/rate_limit/rate_limiter.rs index a3c6f6a276..e93adfa83f 100644 --- a/crates/utils/src/rate_limit/rate_limiter.rs +++ b/crates/utils/src/rate_limit/rate_limiter.rs @@ -136,7 +136,6 @@ impl MapLevel for Map { .entry(addr_part) .or_insert(RateLimitedGroup::new(now, adjusted_configs)); - #[allow(clippy::indexing_slicing)] let total_passes = group.check_total(action_type, now, adjusted_configs[action_type]); let children_pass = group.children.check( @@ -161,7 +160,6 @@ impl MapLevel for Map { // Evaluated if `some_children_remaining` is false let total_has_refill_in_future = || { group.total.into_iter().any(|(action_type, bucket)| { - #[allow(clippy::indexing_slicing)] let config = configs[action_type]; bucket.update(now, config).tokens != config.capacity }) @@ -214,7 +212,6 @@ impl RateLimitedGroup { now: InstantSecs, config: BucketConfig, ) -> bool { - #[allow(clippy::indexing_slicing)] // `EnumMap` has no `get` function let bucket = &mut self.total[action_type]; let new_bucket = bucket.update(now, config); @@ -311,8 +308,7 @@ fn split_ipv6(ip: Ipv6Addr) -> ([u8; 6], u8, u8) { } #[cfg(test)] -#[allow(clippy::unwrap_used)] -#[allow(clippy::indexing_slicing)] +#[expect(clippy::unwrap_used)] mod tests { use super::{ActionType, BucketConfig, InstantSecs, RateLimitState, RateLimitedGroup}; @@ -361,7 +357,6 @@ mod tests { assert!(post_passed); } - #[allow(clippy::indexing_slicing)] let expected_buckets = |factor: u32, tokens_consumed: u32| { let adjusted_configs = bucket_configs.map(|_, config| BucketConfig { capacity: config.capacity.saturating_mul(factor), diff --git a/crates/utils/src/utils/markdown/mod.rs b/crates/utils/src/utils/markdown/mod.rs index 7ed553e06c..79b528aff5 100644 --- a/crates/utils/src/utils/markdown/mod.rs +++ b/crates/utils/src/utils/markdown/mod.rs @@ -107,8 +107,7 @@ pub fn markdown_check_for_blocked_urls(text: &str, blocklist: &RegexSet) -> Lemm } #[cfg(test)] -#[allow(clippy::unwrap_used)] -#[allow(clippy::indexing_slicing)] +#[expect(clippy::unwrap_used)] mod tests { use super::*; diff --git a/crates/utils/src/utils/markdown/spoiler_rule.rs b/crates/utils/src/utils/markdown/spoiler_rule.rs index caced310a2..fd6450b316 100644 --- a/crates/utils/src/utils/markdown/spoiler_rule.rs +++ b/crates/utils/src/utils/markdown/spoiler_rule.rs @@ -134,8 +134,6 @@ pub fn add(markdown_parser: &mut MarkdownIt) { } #[cfg(test)] -#[allow(clippy::unwrap_used)] -#[allow(clippy::indexing_slicing)] mod tests { use crate::utils::markdown::spoiler_rule::add; diff --git a/crates/utils/src/utils/mention.rs b/crates/utils/src/utils/mention.rs index c7cc2043f9..13762ed271 100644 --- a/crates/utils/src/utils/mention.rs +++ b/crates/utils/src/utils/mention.rs @@ -34,8 +34,7 @@ pub fn scrape_text_for_mentions(text: &str) -> Vec { } #[cfg(test)] -#[allow(clippy::unwrap_used)] -#[allow(clippy::indexing_slicing)] +#[expect(clippy::indexing_slicing)] mod test { use crate::utils::mention::scrape_text_for_mentions; diff --git a/crates/utils/src/utils/slurs.rs b/crates/utils/src/utils/slurs.rs index ba94372fa7..0ce5b825e8 100644 --- a/crates/utils/src/utils/slurs.rs +++ b/crates/utils/src/utils/slurs.rs @@ -61,8 +61,7 @@ pub(crate) fn slurs_vec_to_str(slurs: &[&str]) -> String { } #[cfg(test)] -#[allow(clippy::unwrap_used)] -#[allow(clippy::indexing_slicing)] +#[expect(clippy::unwrap_used)] mod test { use crate::utils::slurs::{remove_slurs, slur_check, slurs_vec_to_str}; diff --git a/crates/utils/src/utils/validation.rs b/crates/utils/src/utils/validation.rs index 9493ca2fcb..98b9a2a251 100644 --- a/crates/utils/src/utils/validation.rs +++ b/crates/utils/src/utils/validation.rs @@ -351,7 +351,6 @@ pub fn build_url_str_without_scheme(url_str: &str) -> LemmyResult { } #[cfg(test)] -#[allow(clippy::indexing_slicing)] mod tests { use crate::{ diff --git a/src/scheduled_tasks.rs b/src/scheduled_tasks.rs index b7532d83c1..5f8b1cee10 100644 --- a/src/scheduled_tasks.rs +++ b/src/scheduled_tasks.rs @@ -605,7 +605,7 @@ async fn build_update_instance_form( } #[cfg(test)] -#[allow(clippy::indexing_slicing)] +#[expect(clippy::indexing_slicing)] mod tests { use crate::scheduled_tasks::build_update_instance_form; diff --git a/src/session_middleware.rs b/src/session_middleware.rs index b23f8644ec..0c601bf63f 100644 --- a/src/session_middleware.rs +++ b/src/session_middleware.rs @@ -97,8 +97,8 @@ where } #[cfg(test)] -#[allow(clippy::unwrap_used)] -#[allow(clippy::indexing_slicing)] +#[expect(clippy::unwrap_used)] +#[expect(clippy::indexing_slicing)] mod tests { use super::*;