From 95069d7648afd0cc0abd8990d9581c948536072c Mon Sep 17 00:00:00 2001 From: Dessalines Date: Tue, 26 Mar 2024 05:17:42 -0400 Subject: [PATCH] Fixing some clippy and woodpecker lints. (#4565) * Fixing some clippy and woodpecker lints. * Try fixing woodpecker 1. * Revert "Try fixing woodpecker 1." This reverts commit 7c2020a08d7b72b179b23cf7c56c1d9fcdcb2a6e. --- .woodpecker.yml | 44 ++++++++++--------- crates/api/src/lib.rs | 4 +- 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 +- .../src/collections/community_moderators.rs | 2 +- crates/apub/src/http/community.rs | 4 +- .../src/aggregates/comment_aggregates.rs | 4 +- .../src/aggregates/community_aggregates.rs | 4 +- .../src/aggregates/person_aggregates.rs | 4 +- .../src/aggregates/post_aggregates.rs | 4 +- .../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/comment_reply.rs | 4 +- crates/db_schema/src/impls/community.rs | 4 +- .../src/impls/federation_allowlist.rs | 4 +- crates/db_schema/src/impls/language.rs | 4 +- crates/db_schema/src/impls/moderator.rs | 4 +- .../src/impls/password_reset_request.rs | 4 +- crates/db_schema/src/impls/person.rs | 4 +- crates/db_schema/src/impls/person_mention.rs | 4 +- 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/utils.rs | 4 +- 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 +- .../src/private_message_report_view.rs | 4 +- crates/db_views/src/private_message_view.rs | 4 +- .../src/registration_application_view.rs | 4 +- crates/db_views/src/vote_view.rs | 4 +- crates/db_views_actor/src/community_view.rs | 4 +- crates/db_views_actor/src/person_view.rs | 4 +- crates/utils/src/rate_limit/mod.rs | 4 +- crates/utils/src/rate_limit/rate_limiter.rs | 4 +- crates/utils/src/utils/markdown/mod.rs | 4 +- .../utils/src/utils/markdown/spoiler_rule.rs | 4 +- crates/utils/src/utils/mention.rs | 4 +- crates/utils/src/utils/slurs.rs | 4 +- crates/utils/src/utils/validation.rs | 4 +- src/scheduled_tasks.rs | 4 +- src/session_middleware.rs | 4 +- 52 files changed, 121 insertions(+), 119 deletions(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index a1f008bd0..ab38db329 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -6,21 +6,23 @@ variables: - &install_pnpm "corepack enable pnpm" - &slow_check_paths - path: - # rust source code - - "crates/**" - - "src/**" - - "**/Cargo.toml" - - "Cargo.lock" - # database migrations - - "migrations/**" - # typescript tests - - "api_tests/**" - # config files and scripts used by ci - - ".woodpecker.yml" - - ".rustfmt.toml" - - "scripts/update_config_defaults.sh" - - "diesel.toml" - - ".gitmodules" + include: [ + # rust source code + "crates/**", + "src/**", + "**/Cargo.toml", + "Cargo.lock", + # database migrations + "migrations/**", + # typescript tests + "api_tests/**", + # config files and scripts used by ci + ".woodpecker.yml", + ".rustfmt.toml", + "scripts/update_config_defaults.sh", + "diesel.toml", + ".gitmodules", + ] # Broken for cron jobs currently, see # https://github.com/woodpecker-ci/woodpecker/issues/1716 @@ -198,7 +200,7 @@ steps: - cat target/log/lemmy_*.out || true - "# If you can't see all output, then use the download button" when: - status: [failure] + - status: [failure] publish_release_docker: image: woodpeckerci/plugin-docker-buildx @@ -211,7 +213,7 @@ steps: - RUST_RELEASE_MODE=release tag: ${CI_COMMIT_TAG} when: - event: tag + - event: tag nightly_build: image: woodpeckerci/plugin-docker-buildx @@ -224,7 +226,7 @@ steps: - RUST_RELEASE_MODE=release tag: dev when: - event: cron + - event: cron # using https://github.com/pksunkara/cargo-workspaces publish_to_crates_io: @@ -237,7 +239,7 @@ steps: - cargo workspaces publish --from-git --allow-dirty --no-verify --allow-branch "${CI_COMMIT_TAG}" --yes custom "${CI_COMMIT_TAG}" secrets: [cargo_api_token] when: - event: tag + - event: tag notify_on_failure: image: alpine:3 @@ -245,7 +247,7 @@ steps: - apk add curl - "curl -d'Lemmy CI build failed: ${CI_PIPELINE_URL}' ntfy.sh/lemmy_drone_ci" when: - status: [failure] + - status: [failure] notify_on_tag_deploy: image: alpine:3 @@ -253,7 +255,7 @@ steps: - apk add curl - "curl -d'lemmy:${CI_COMMIT_TAG} deployed' ntfy.sh/lemmy_drone_ci" when: - event: tag + - event: tag services: database: diff --git a/crates/api/src/lib.rs b/crates/api/src/lib.rs index 814dd67eb..d65ae0a28 100644 --- a/crates/api/src/lib.rs +++ b/crates/api/src/lib.rs @@ -259,9 +259,9 @@ pub async fn local_user_view_from_jwt( } #[cfg(test)] +#[allow(clippy::unwrap_used)] +#[allow(clippy::indexing_slicing)] mod tests { - #![allow(clippy::unwrap_used)] - #![allow(clippy::indexing_slicing)] use super::*; diff --git a/crates/api/src/sitemap.rs b/crates/api/src/sitemap.rs index ec32f837f..bd0e0dad8 100644 --- a/crates/api/src/sitemap.rs +++ b/crates/api/src/sitemap.rs @@ -42,8 +42,8 @@ pub async fn get_sitemap(context: Data) -> LemmyResult Resu } #[cfg(test)] +#[allow(clippy::unwrap_used)] +#[allow(clippy::indexing_slicing)] mod tests { - #![allow(clippy::unwrap_used)] - #![allow(clippy::indexing_slicing)] use crate::{ context::LemmyContext, diff --git a/crates/api_common/src/utils.rs b/crates/api_common/src/utils.rs index b13d21f9f..e4ab91b08 100644 --- a/crates/api_common/src/utils.rs +++ b/crates/api_common/src/utils.rs @@ -1019,9 +1019,9 @@ pub async fn proxy_image_link_opt_apub( } #[cfg(test)] +#[allow(clippy::unwrap_used)] +#[allow(clippy::indexing_slicing)] mod tests { - #![allow(clippy::unwrap_used)] - #![allow(clippy::indexing_slicing)] use super::*; use pretty_assertions::assert_eq; diff --git a/crates/api_crud/src/site/create.rs b/crates/api_crud/src/site/create.rs index 76aae405e..8542117e7 100644 --- a/crates/api_crud/src/site/create.rs +++ b/crates/api_crud/src/site/create.rs @@ -189,9 +189,9 @@ fn validate_create_payload(local_site: &LocalSite, create_site: &CreateSite) -> } #[cfg(test)] +#[allow(clippy::unwrap_used)] +#[allow(clippy::indexing_slicing)] mod tests { - #![allow(clippy::unwrap_used)] - #![allow(clippy::indexing_slicing)] use crate::site::create::validate_create_payload; use lemmy_api_common::site::CreateSite; diff --git a/crates/api_crud/src/site/mod.rs b/crates/api_crud/src/site/mod.rs index e4911ba48..0bf7cc279 100644 --- a/crates/api_crud/src/site/mod.rs +++ b/crates/api_crud/src/site/mod.rs @@ -41,9 +41,9 @@ pub fn application_question_check( } #[cfg(test)] +#[allow(clippy::unwrap_used)] +#[allow(clippy::indexing_slicing)] mod tests { - #![allow(clippy::unwrap_used)] - #![allow(clippy::indexing_slicing)] use crate::site::{application_question_check, site_default_post_listing_type_check}; use lemmy_db_schema::{ListingType, RegistrationMode}; diff --git a/crates/api_crud/src/site/update.rs b/crates/api_crud/src/site/update.rs index 809dbe498..6d419a6d8 100644 --- a/crates/api_crud/src/site/update.rs +++ b/crates/api_crud/src/site/update.rs @@ -231,9 +231,9 @@ fn validate_update_payload(local_site: &LocalSite, edit_site: &EditSite) -> Lemm } #[cfg(test)] +#[allow(clippy::unwrap_used)] +#[allow(clippy::indexing_slicing)] mod tests { - #![allow(clippy::unwrap_used)] - #![allow(clippy::indexing_slicing)] use crate::site::update::validate_update_payload; use lemmy_api_common::site::EditSite; diff --git a/crates/apub/src/activity_lists.rs b/crates/apub/src/activity_lists.rs index 206f0088b..7b33499c8 100644 --- a/crates/apub/src/activity_lists.rs +++ b/crates/apub/src/activity_lists.rs @@ -123,8 +123,8 @@ impl InCommunity for AnnouncableActivities { } #[cfg(test)] +#[allow(clippy::indexing_slicing)] mod tests { - #![allow(clippy::indexing_slicing)] use crate::{ activity_lists::{GroupInboxActivities, PersonInboxActivities, SharedInboxActivities}, diff --git a/crates/apub/src/api/user_settings_backup.rs b/crates/apub/src/api/user_settings_backup.rs index d46e415b0..4c1edcbff 100644 --- a/crates/apub/src/api/user_settings_backup.rs +++ b/crates/apub/src/api/user_settings_backup.rs @@ -319,8 +319,8 @@ pub async fn import_settings( } #[cfg(test)] +#[allow(clippy::indexing_slicing)] mod tests { - #![allow(clippy::indexing_slicing)] use crate::api::user_settings_backup::{export_settings, import_settings}; use activitypub_federation::config::Data; diff --git a/crates/apub/src/collections/community_moderators.rs b/crates/apub/src/collections/community_moderators.rs index 87d88d071..0532d0aef 100644 --- a/crates/apub/src/collections/community_moderators.rs +++ b/crates/apub/src/collections/community_moderators.rs @@ -101,8 +101,8 @@ impl Collection for ApubCommunityModerators { } #[cfg(test)] +#[allow(clippy::indexing_slicing)] mod tests { - #![allow(clippy::indexing_slicing)] use super::*; use crate::{ diff --git a/crates/apub/src/http/community.rs b/crates/apub/src/http/community.rs index 83ccdacf9..cf0d1625d 100644 --- a/crates/apub/src/http/community.rs +++ b/crates/apub/src/http/community.rs @@ -115,9 +115,9 @@ pub(crate) async fn get_apub_community_featured( } #[cfg(test)] +#[allow(clippy::unwrap_used)] +#[allow(clippy::indexing_slicing)] pub(crate) mod tests { - #![allow(clippy::unwrap_used)] - #![allow(clippy::indexing_slicing)] use super::*; use crate::protocol::objects::{group::Group, tombstone::Tombstone}; diff --git a/crates/db_schema/src/aggregates/comment_aggregates.rs b/crates/db_schema/src/aggregates/comment_aggregates.rs index 78ceaa0c6..2120c7f38 100644 --- a/crates/db_schema/src/aggregates/comment_aggregates.rs +++ b/crates/db_schema/src/aggregates/comment_aggregates.rs @@ -33,9 +33,9 @@ impl CommentAggregates { } #[cfg(test)] +#[allow(clippy::unwrap_used)] +#[allow(clippy::indexing_slicing)] mod tests { - #![allow(clippy::unwrap_used)] - #![allow(clippy::indexing_slicing)] use crate::{ aggregates::comment_aggregates::CommentAggregates, diff --git a/crates/db_schema/src/aggregates/community_aggregates.rs b/crates/db_schema/src/aggregates/community_aggregates.rs index 334688b97..f1f54663b 100644 --- a/crates/db_schema/src/aggregates/community_aggregates.rs +++ b/crates/db_schema/src/aggregates/community_aggregates.rs @@ -31,9 +31,9 @@ impl CommunityAggregates { } #[cfg(test)] +#[allow(clippy::unwrap_used)] +#[allow(clippy::indexing_slicing)] mod tests { - #![allow(clippy::unwrap_used)] - #![allow(clippy::indexing_slicing)] use crate::{ aggregates::community_aggregates::CommunityAggregates, diff --git a/crates/db_schema/src/aggregates/person_aggregates.rs b/crates/db_schema/src/aggregates/person_aggregates.rs index b48b37641..520b45225 100644 --- a/crates/db_schema/src/aggregates/person_aggregates.rs +++ b/crates/db_schema/src/aggregates/person_aggregates.rs @@ -18,9 +18,9 @@ impl PersonAggregates { } #[cfg(test)] +#[allow(clippy::unwrap_used)] +#[allow(clippy::indexing_slicing)] mod tests { - #![allow(clippy::unwrap_used)] - #![allow(clippy::indexing_slicing)] use crate::{ aggregates::person_aggregates::PersonAggregates, diff --git a/crates/db_schema/src/aggregates/post_aggregates.rs b/crates/db_schema/src/aggregates/post_aggregates.rs index 9415f8971..7f95dc05a 100644 --- a/crates/db_schema/src/aggregates/post_aggregates.rs +++ b/crates/db_schema/src/aggregates/post_aggregates.rs @@ -52,9 +52,9 @@ impl PostAggregates { } #[cfg(test)] +#[allow(clippy::unwrap_used)] +#[allow(clippy::indexing_slicing)] mod tests { - #![allow(clippy::unwrap_used)] - #![allow(clippy::indexing_slicing)] use crate::{ aggregates::post_aggregates::PostAggregates, diff --git a/crates/db_schema/src/aggregates/site_aggregates.rs b/crates/db_schema/src/aggregates/site_aggregates.rs index 453430841..b179ff7c7 100644 --- a/crates/db_schema/src/aggregates/site_aggregates.rs +++ b/crates/db_schema/src/aggregates/site_aggregates.rs @@ -14,9 +14,9 @@ impl SiteAggregates { } #[cfg(test)] +#[allow(clippy::unwrap_used)] +#[allow(clippy::indexing_slicing)] mod tests { - #![allow(clippy::unwrap_used)] - #![allow(clippy::indexing_slicing)] use crate::{ aggregates::site_aggregates::SiteAggregates, diff --git a/crates/db_schema/src/impls/activity.rs b/crates/db_schema/src/impls/activity.rs index bb17c83e7..e1802c7c5 100644 --- a/crates/db_schema/src/impls/activity.rs +++ b/crates/db_schema/src/impls/activity.rs @@ -61,9 +61,9 @@ impl ReceivedActivity { } #[cfg(test)] +#[allow(clippy::unwrap_used)] +#[allow(clippy::indexing_slicing)] mod tests { - #![allow(clippy::unwrap_used)] - #![allow(clippy::indexing_slicing)] use super::*; use crate::{source::activity::ActorType, utils::build_db_pool_for_tests}; diff --git a/crates/db_schema/src/impls/actor_language.rs b/crates/db_schema/src/impls/actor_language.rs index 29d99b2d8..0191dd872 100644 --- a/crates/db_schema/src/impls/actor_language.rs +++ b/crates/db_schema/src/impls/actor_language.rs @@ -385,9 +385,9 @@ async fn convert_read_languages( } #[cfg(test)] +#[allow(clippy::unwrap_used)] +#[allow(clippy::indexing_slicing)] mod tests { - #![allow(clippy::unwrap_used)] - #![allow(clippy::indexing_slicing)] use super::*; use crate::{ diff --git a/crates/db_schema/src/impls/captcha_answer.rs b/crates/db_schema/src/impls/captcha_answer.rs index 72e2d1285..1d0604c0a 100644 --- a/crates/db_schema/src/impls/captcha_answer.rs +++ b/crates/db_schema/src/impls/captcha_answer.rs @@ -48,9 +48,9 @@ impl CaptchaAnswer { } #[cfg(test)] +#[allow(clippy::unwrap_used)] +#[allow(clippy::indexing_slicing)] mod tests { - #![allow(clippy::unwrap_used)] - #![allow(clippy::indexing_slicing)] use crate::{ source::captcha_answer::{CaptchaAnswer, CaptchaAnswerForm, CheckCaptchaAnswer}, diff --git a/crates/db_schema/src/impls/comment.rs b/crates/db_schema/src/impls/comment.rs index 979c3b721..b27d44591 100644 --- a/crates/db_schema/src/impls/comment.rs +++ b/crates/db_schema/src/impls/comment.rs @@ -241,9 +241,9 @@ impl Saveable for CommentSaved { } #[cfg(test)] +#[allow(clippy::unwrap_used)] +#[allow(clippy::indexing_slicing)] mod tests { - #![allow(clippy::unwrap_used)] - #![allow(clippy::indexing_slicing)] use crate::{ newtypes::LanguageId, diff --git a/crates/db_schema/src/impls/comment_reply.rs b/crates/db_schema/src/impls/comment_reply.rs index d76b46b8a..40c99e045 100644 --- a/crates/db_schema/src/impls/comment_reply.rs +++ b/crates/db_schema/src/impls/comment_reply.rs @@ -73,9 +73,9 @@ impl CommentReply { } #[cfg(test)] +#[allow(clippy::unwrap_used)] +#[allow(clippy::indexing_slicing)] mod tests { - #![allow(clippy::unwrap_used)] - #![allow(clippy::indexing_slicing)] use crate::{ source::{ diff --git a/crates/db_schema/src/impls/community.rs b/crates/db_schema/src/impls/community.rs index 88b0ef46d..dbacbcb72 100644 --- a/crates/db_schema/src/impls/community.rs +++ b/crates/db_schema/src/impls/community.rs @@ -381,9 +381,9 @@ impl ApubActor for Community { } #[cfg(test)] +#[allow(clippy::unwrap_used)] +#[allow(clippy::indexing_slicing)] mod tests { - #![allow(clippy::unwrap_used)] - #![allow(clippy::indexing_slicing)] use crate::{ source::{ diff --git a/crates/db_schema/src/impls/federation_allowlist.rs b/crates/db_schema/src/impls/federation_allowlist.rs index 0664a8a4f..80408a526 100644 --- a/crates/db_schema/src/impls/federation_allowlist.rs +++ b/crates/db_schema/src/impls/federation_allowlist.rs @@ -48,9 +48,9 @@ impl FederationAllowList { } } #[cfg(test)] +#[allow(clippy::unwrap_used)] +#[allow(clippy::indexing_slicing)] mod tests { - #![allow(clippy::unwrap_used)] - #![allow(clippy::indexing_slicing)] use crate::{ source::{federation_allowlist::FederationAllowList, instance::Instance}, diff --git a/crates/db_schema/src/impls/language.rs b/crates/db_schema/src/impls/language.rs index 66fc05729..905221402 100644 --- a/crates/db_schema/src/impls/language.rs +++ b/crates/db_schema/src/impls/language.rs @@ -41,9 +41,9 @@ impl Language { } #[cfg(test)] +#[allow(clippy::unwrap_used)] +#[allow(clippy::indexing_slicing)] mod tests { - #![allow(clippy::unwrap_used)] - #![allow(clippy::indexing_slicing)] use crate::{source::language::Language, utils::build_db_pool_for_tests}; use pretty_assertions::assert_eq; diff --git a/crates/db_schema/src/impls/moderator.rs b/crates/db_schema/src/impls/moderator.rs index cfb64d883..99f117878 100644 --- a/crates/db_schema/src/impls/moderator.rs +++ b/crates/db_schema/src/impls/moderator.rs @@ -465,9 +465,9 @@ impl Crud for AdminPurgeComment { } #[cfg(test)] +#[allow(clippy::unwrap_used)] +#[allow(clippy::indexing_slicing)] mod tests { - #![allow(clippy::unwrap_used)] - #![allow(clippy::indexing_slicing)] use crate::{ source::{ diff --git a/crates/db_schema/src/impls/password_reset_request.rs b/crates/db_schema/src/impls/password_reset_request.rs index 3b910b1d3..491097135 100644 --- a/crates/db_schema/src/impls/password_reset_request.rs +++ b/crates/db_schema/src/impls/password_reset_request.rs @@ -81,9 +81,9 @@ impl PasswordResetRequest { } #[cfg(test)] +#[allow(clippy::unwrap_used)] +#[allow(clippy::indexing_slicing)] mod tests { - #![allow(clippy::unwrap_used)] - #![allow(clippy::indexing_slicing)] use crate::{ source::{ diff --git a/crates/db_schema/src/impls/person.rs b/crates/db_schema/src/impls/person.rs index 0de7c32f5..c90f67891 100644 --- a/crates/db_schema/src/impls/person.rs +++ b/crates/db_schema/src/impls/person.rs @@ -212,9 +212,9 @@ impl PersonFollower { } #[cfg(test)] +#[allow(clippy::unwrap_used)] +#[allow(clippy::indexing_slicing)] mod tests { - #![allow(clippy::unwrap_used)] - #![allow(clippy::indexing_slicing)] use crate::{ source::{ diff --git a/crates/db_schema/src/impls/person_mention.rs b/crates/db_schema/src/impls/person_mention.rs index 75950e7e9..9882e662c 100644 --- a/crates/db_schema/src/impls/person_mention.rs +++ b/crates/db_schema/src/impls/person_mention.rs @@ -74,9 +74,9 @@ impl PersonMention { } #[cfg(test)] +#[allow(clippy::unwrap_used)] +#[allow(clippy::indexing_slicing)] mod tests { - #![allow(clippy::unwrap_used)] - #![allow(clippy::indexing_slicing)] use crate::{ source::{ diff --git a/crates/db_schema/src/impls/post.rs b/crates/db_schema/src/impls/post.rs index 3425a795d..8db871ad5 100644 --- a/crates/db_schema/src/impls/post.rs +++ b/crates/db_schema/src/impls/post.rs @@ -362,9 +362,9 @@ impl PostHide { } #[cfg(test)] +#[allow(clippy::unwrap_used)] +#[allow(clippy::indexing_slicing)] mod tests { - #![allow(clippy::unwrap_used)] - #![allow(clippy::indexing_slicing)] use crate::{ source::{ diff --git a/crates/db_schema/src/impls/post_report.rs b/crates/db_schema/src/impls/post_report.rs index face766db..260574bd2 100644 --- a/crates/db_schema/src/impls/post_report.rs +++ b/crates/db_schema/src/impls/post_report.rs @@ -80,9 +80,9 @@ impl Reportable for PostReport { } #[cfg(test)] +#[allow(clippy::unwrap_used)] +#[allow(clippy::indexing_slicing)] mod tests { - #![allow(clippy::unwrap_used)] - #![allow(clippy::indexing_slicing)] use super::*; use crate::{ diff --git a/crates/db_schema/src/impls/private_message.rs b/crates/db_schema/src/impls/private_message.rs index 961e36518..ee0009189 100644 --- a/crates/db_schema/src/impls/private_message.rs +++ b/crates/db_schema/src/impls/private_message.rs @@ -74,9 +74,9 @@ impl PrivateMessage { } #[cfg(test)] +#[allow(clippy::unwrap_used)] +#[allow(clippy::indexing_slicing)] mod tests { - #![allow(clippy::unwrap_used)] - #![allow(clippy::indexing_slicing)] use crate::{ source::{ diff --git a/crates/db_schema/src/utils.rs b/crates/db_schema/src/utils.rs index 9a89902e7..465ecb4cd 100644 --- a/crates/db_schema/src/utils.rs +++ b/crates/db_schema/src/utils.rs @@ -536,9 +536,9 @@ impl Queries { } #[cfg(test)] +#[allow(clippy::unwrap_used)] +#[allow(clippy::indexing_slicing)] mod tests { - #![allow(clippy::unwrap_used)] - #![allow(clippy::indexing_slicing)] use super::*; use pretty_assertions::assert_eq; diff --git a/crates/db_views/src/comment_report_view.rs b/crates/db_views/src/comment_report_view.rs index 317ebf29a..0da5b3cff 100644 --- a/crates/db_views/src/comment_report_view.rs +++ b/crates/db_views/src/comment_report_view.rs @@ -258,9 +258,9 @@ impl CommentReportQuery { } #[cfg(test)] +#[allow(clippy::unwrap_used)] +#[allow(clippy::indexing_slicing)] mod tests { - #![allow(clippy::unwrap_used)] - #![allow(clippy::indexing_slicing)] use crate::{ comment_report_view::{CommentReportQuery, CommentReportView}, diff --git a/crates/db_views/src/comment_view.rs b/crates/db_views/src/comment_view.rs index f8e91b501..01ff394eb 100644 --- a/crates/db_views/src/comment_view.rs +++ b/crates/db_views/src/comment_view.rs @@ -426,9 +426,9 @@ impl<'a> CommentQuery<'a> { } #[cfg(test)] +#[allow(clippy::unwrap_used)] +#[allow(clippy::indexing_slicing)] mod tests { - #![allow(clippy::unwrap_used)] - #![allow(clippy::indexing_slicing)] use crate::{ comment_view::{CommentQuery, CommentSortType, CommentView, DbPool}, diff --git a/crates/db_views/src/post_report_view.rs b/crates/db_views/src/post_report_view.rs index 20795c8c0..878937d01 100644 --- a/crates/db_views/src/post_report_view.rs +++ b/crates/db_views/src/post_report_view.rs @@ -283,9 +283,9 @@ impl PostReportQuery { } #[cfg(test)] +#[allow(clippy::unwrap_used)] +#[allow(clippy::indexing_slicing)] mod tests { - #![allow(clippy::unwrap_used)] - #![allow(clippy::indexing_slicing)] use crate::{ post_report_view::{PostReportQuery, PostReportView}, diff --git a/crates/db_views/src/private_message_report_view.rs b/crates/db_views/src/private_message_report_view.rs index 2c6919542..091071b16 100644 --- a/crates/db_views/src/private_message_report_view.rs +++ b/crates/db_views/src/private_message_report_view.rs @@ -106,9 +106,9 @@ impl PrivateMessageReportQuery { } #[cfg(test)] +#[allow(clippy::unwrap_used)] +#[allow(clippy::indexing_slicing)] mod tests { - #![allow(clippy::unwrap_used)] - #![allow(clippy::indexing_slicing)] use crate::private_message_report_view::PrivateMessageReportQuery; use lemmy_db_schema::{ diff --git a/crates/db_views/src/private_message_view.rs b/crates/db_views/src/private_message_view.rs index a3e2469c9..466f3bdf0 100644 --- a/crates/db_views/src/private_message_view.rs +++ b/crates/db_views/src/private_message_view.rs @@ -173,9 +173,9 @@ impl PrivateMessageQuery { } #[cfg(test)] +#[allow(clippy::unwrap_used)] +#[allow(clippy::indexing_slicing)] mod tests { - #![allow(clippy::unwrap_used)] - #![allow(clippy::indexing_slicing)] use crate::{private_message_view::PrivateMessageQuery, structs::PrivateMessageView}; use lemmy_db_schema::{ diff --git a/crates/db_views/src/registration_application_view.rs b/crates/db_views/src/registration_application_view.rs index c2f2e3120..85916bb90 100644 --- a/crates/db_views/src/registration_application_view.rs +++ b/crates/db_views/src/registration_application_view.rs @@ -127,9 +127,9 @@ impl RegistrationApplicationQuery { } #[cfg(test)] +#[allow(clippy::unwrap_used)] +#[allow(clippy::indexing_slicing)] mod tests { - #![allow(clippy::unwrap_used)] - #![allow(clippy::indexing_slicing)] use crate::registration_application_view::{ RegistrationApplicationQuery, diff --git a/crates/db_views/src/vote_view.rs b/crates/db_views/src/vote_view.rs index 723c188f5..26df3bdbb 100644 --- a/crates/db_views/src/vote_view.rs +++ b/crates/db_views/src/vote_view.rs @@ -50,9 +50,9 @@ impl VoteView { } #[cfg(test)] +#[allow(clippy::unwrap_used)] +#[allow(clippy::indexing_slicing)] mod tests { - #![allow(clippy::unwrap_used)] - #![allow(clippy::indexing_slicing)] use crate::structs::VoteView; use lemmy_db_schema::{ diff --git a/crates/db_views_actor/src/community_view.rs b/crates/db_views_actor/src/community_view.rs index 98a146c15..3107478dc 100644 --- a/crates/db_views_actor/src/community_view.rs +++ b/crates/db_views_actor/src/community_view.rs @@ -250,9 +250,9 @@ impl<'a> CommunityQuery<'a> { } #[cfg(test)] +#[allow(clippy::unwrap_used)] +#[allow(clippy::indexing_slicing)] mod tests { - #![allow(clippy::unwrap_used)] - #![allow(clippy::indexing_slicing)] use crate::{community_view::CommunityQuery, structs::CommunityView}; use lemmy_db_schema::{ diff --git a/crates/db_views_actor/src/person_view.rs b/crates/db_views_actor/src/person_view.rs index 1ee51a819..b3eac296d 100644 --- a/crates/db_views_actor/src/person_view.rs +++ b/crates/db_views_actor/src/person_view.rs @@ -163,9 +163,9 @@ impl PersonQuery { } #[cfg(test)] +#[allow(clippy::unwrap_used)] +#[allow(clippy::indexing_slicing)] mod tests { - #![allow(clippy::unwrap_used)] - #![allow(clippy::indexing_slicing)] use super::*; use diesel::NotFound; diff --git a/crates/utils/src/rate_limit/mod.rs b/crates/utils/src/rate_limit/mod.rs index b2efbe2c9..de64bac46 100644 --- a/crates/utils/src/rate_limit/mod.rs +++ b/crates/utils/src/rate_limit/mod.rs @@ -221,9 +221,9 @@ fn parse_ip(addr: &str) -> Option { } #[cfg(test)] +#[allow(clippy::unwrap_used)] +#[allow(clippy::indexing_slicing)] mod tests { - #![allow(clippy::unwrap_used)] - #![allow(clippy::indexing_slicing)] #[test] fn test_parse_ip() { diff --git a/crates/utils/src/rate_limit/rate_limiter.rs b/crates/utils/src/rate_limit/rate_limiter.rs index 66d830c7e..3f89aee7e 100644 --- a/crates/utils/src/rate_limit/rate_limiter.rs +++ b/crates/utils/src/rate_limit/rate_limiter.rs @@ -306,9 +306,9 @@ fn split_ipv6(ip: Ipv6Addr) -> ([u8; 6], u8, u8) { } #[cfg(test)] +#[allow(clippy::unwrap_used)] +#[allow(clippy::indexing_slicing)] mod tests { - #![allow(clippy::unwrap_used)] - #![allow(clippy::indexing_slicing)] use super::{ActionType, BucketConfig, InstantSecs, RateLimitState, RateLimitedGroup}; use pretty_assertions::assert_eq; diff --git a/crates/utils/src/utils/markdown/mod.rs b/crates/utils/src/utils/markdown/mod.rs index c3def13a7..87e2cb3a2 100644 --- a/crates/utils/src/utils/markdown/mod.rs +++ b/crates/utils/src/utils/markdown/mod.rs @@ -107,9 +107,9 @@ pub fn markdown_check_for_blocked_urls(text: &str, blocklist: &RegexSet) -> Lemm } #[cfg(test)] +#[allow(clippy::unwrap_used)] +#[allow(clippy::indexing_slicing)] mod tests { - #![allow(clippy::unwrap_used)] - #![allow(clippy::indexing_slicing)] use super::*; use pretty_assertions::assert_eq; diff --git a/crates/utils/src/utils/markdown/spoiler_rule.rs b/crates/utils/src/utils/markdown/spoiler_rule.rs index e41ea436f..3f12807fd 100644 --- a/crates/utils/src/utils/markdown/spoiler_rule.rs +++ b/crates/utils/src/utils/markdown/spoiler_rule.rs @@ -134,9 +134,9 @@ pub fn add(markdown_parser: &mut MarkdownIt) { } #[cfg(test)] +#[allow(clippy::unwrap_used)] +#[allow(clippy::indexing_slicing)] mod tests { - #![allow(clippy::unwrap_used)] - #![allow(clippy::indexing_slicing)] use crate::utils::markdown::spoiler_rule::add; use markdown_it::MarkdownIt; diff --git a/crates/utils/src/utils/mention.rs b/crates/utils/src/utils/mention.rs index 9e9ee64a2..7e5e5f27c 100644 --- a/crates/utils/src/utils/mention.rs +++ b/crates/utils/src/utils/mention.rs @@ -34,9 +34,9 @@ pub fn scrape_text_for_mentions(text: &str) -> Vec { } #[cfg(test)] +#[allow(clippy::unwrap_used)] +#[allow(clippy::indexing_slicing)] mod test { - #![allow(clippy::unwrap_used)] - #![allow(clippy::indexing_slicing)] use crate::utils::mention::scrape_text_for_mentions; use pretty_assertions::assert_eq; diff --git a/crates/utils/src/utils/slurs.rs b/crates/utils/src/utils/slurs.rs index fba43d706..e379ae439 100644 --- a/crates/utils/src/utils/slurs.rs +++ b/crates/utils/src/utils/slurs.rs @@ -64,9 +64,9 @@ pub(crate) fn slurs_vec_to_str(slurs: &[&str]) -> String { } #[cfg(test)] +#[allow(clippy::unwrap_used)] +#[allow(clippy::indexing_slicing)] mod test { - #![allow(clippy::unwrap_used)] - #![allow(clippy::indexing_slicing)] use crate::utils::slurs::{remove_slurs, slur_check, slurs_vec_to_str}; use pretty_assertions::assert_eq; diff --git a/crates/utils/src/utils/validation.rs b/crates/utils/src/utils/validation.rs index f9b2a87e5..93d581327 100644 --- a/crates/utils/src/utils/validation.rs +++ b/crates/utils/src/utils/validation.rs @@ -327,9 +327,9 @@ pub fn check_urls_are_valid(urls: &Vec) -> LemmyResult> { } #[cfg(test)] +#[allow(clippy::unwrap_used)] +#[allow(clippy::indexing_slicing)] mod tests { - #![allow(clippy::unwrap_used)] - #![allow(clippy::indexing_slicing)] use crate::{ error::LemmyErrorType, diff --git a/src/scheduled_tasks.rs b/src/scheduled_tasks.rs index 38eb4ece2..491902fb3 100644 --- a/src/scheduled_tasks.rs +++ b/src/scheduled_tasks.rs @@ -517,9 +517,9 @@ async fn update_instance_software( } #[cfg(test)] +#[allow(clippy::unwrap_used)] +#[allow(clippy::indexing_slicing)] mod tests { - #![allow(clippy::unwrap_used)] - #![allow(clippy::indexing_slicing)] use lemmy_routes::nodeinfo::NodeInfo; use pretty_assertions::assert_eq; diff --git a/src/session_middleware.rs b/src/session_middleware.rs index 474709dbe..2bee64ca0 100644 --- a/src/session_middleware.rs +++ b/src/session_middleware.rs @@ -98,9 +98,9 @@ where } #[cfg(test)] +#[allow(clippy::unwrap_used)] +#[allow(clippy::indexing_slicing)] mod tests { - #![allow(clippy::unwrap_used)] - #![allow(clippy::indexing_slicing)] use super::*; use actix_web::test::TestRequest;