mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-25 22:01:19 +00:00
Cache & Optimize Woodpecker CI (#3450)
* Try using drone cache plugin * Try another path * Include volume * Fix formatting * Include fmt * Exclude cargo dir from prettier * Don't override cargo * Just do check * Add cache key * Use different cache plugin * Add clippy * Try minio * Add quotes * Try adding secrets * Try again * Again * Use correct secret formation * Add back clippy * Use secret for the root bucket name * Try drone cache instead * Add region * Add path-style option * Include cargo clippy * Include everything again * Fix formatting * Don't run clippy twice * Add `allow` statements for tests to pass * Adjust endpoint to be a secret * Fix prettier * Merge & fix tests * Try to restart the woodpecker test * Change the ENV var name --------- Co-authored-by: Dessalines <dessalines@users.noreply.github.com>
This commit is contained in:
parent
88215bfbc9
commit
9256895635
65 changed files with 233 additions and 6 deletions
|
@ -27,6 +27,29 @@ pipeline:
|
|||
commands:
|
||||
- prettier -c . '!**/volumes' '!**/dist' '!target' '!**/translations'
|
||||
|
||||
restore-cache:
|
||||
image: meltwater/drone-cache:v1
|
||||
pull: true
|
||||
settings:
|
||||
restore: true
|
||||
endpoint:
|
||||
from_secret: MINIO_ENDPOINT
|
||||
access-key:
|
||||
from_secret: MINIO_WRITE_USER
|
||||
secret-key:
|
||||
from_secret: MINIO_WRITE_PASSWORD
|
||||
bucket:
|
||||
from_secret: MINIO_BUCKET
|
||||
region: us-east-1
|
||||
cache_key: "rust-cache"
|
||||
path-style: true
|
||||
mount:
|
||||
- ".cargo"
|
||||
- "target"
|
||||
- "api_tests/node_modules"
|
||||
secrets:
|
||||
[MINIO_ENDPOINT, MINIO_WRITE_USER, MINIO_WRITE_PASSWORD, MINIO_BUCKET]
|
||||
|
||||
taplo_check:
|
||||
image: tamasfe/taplo:0.8.1
|
||||
commands:
|
||||
|
@ -40,7 +63,7 @@ pipeline:
|
|||
CARGO_HOME: .cargo
|
||||
commands:
|
||||
# need make existing toolchain available
|
||||
- cp ~/.cargo . -r
|
||||
- cp -n ~/.cargo . -r
|
||||
- rustup toolchain install nightly-2023-07-10
|
||||
- rustup component add rustfmt --toolchain nightly-2023-07-10
|
||||
- cargo +nightly-2023-07-10 fmt -- --check
|
||||
|
@ -68,7 +91,6 @@ pipeline:
|
|||
-D clippy::explicit_into_iter_loop
|
||||
-D clippy::explicit_iter_loop
|
||||
-D clippy::needless_collect
|
||||
- cargo clippy --workspace --features console --
|
||||
-D clippy::unwrap_used
|
||||
-D clippy::indexing_slicing
|
||||
# when:
|
||||
|
@ -158,6 +180,29 @@ pipeline:
|
|||
# when:
|
||||
# platform: linux/amd64
|
||||
|
||||
rebuild-cache:
|
||||
image: meltwater/drone-cache:v1
|
||||
pull: true
|
||||
settings:
|
||||
rebuild: true
|
||||
endpoint:
|
||||
from_secret: MINIO_ENDPOINT
|
||||
access-key:
|
||||
from_secret: MINIO_WRITE_USER
|
||||
secret-key:
|
||||
from_secret: MINIO_WRITE_PASSWORD
|
||||
bucket:
|
||||
from_secret: MINIO_BUCKET
|
||||
cache_key: "rust-cache"
|
||||
region: us-east-1
|
||||
path-style: true
|
||||
mount:
|
||||
- ".cargo"
|
||||
- "target"
|
||||
- "api_tests/node_modules"
|
||||
secrets:
|
||||
[MINIO_ENDPOINT, MINIO_WRITE_USER, MINIO_WRITE_PASSWORD, MINIO_BUCKET]
|
||||
|
||||
publish_release_docker:
|
||||
image: woodpeckerci/plugin-docker-buildx
|
||||
secrets: [docker_username, docker_password]
|
||||
|
|
|
@ -76,6 +76,9 @@ pub(crate) fn check_report_reason(reason: &str, local_site: &LocalSite) -> Resul
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#![allow(clippy::unwrap_used)]
|
||||
#![allow(clippy::indexing_slicing)]
|
||||
|
||||
use lemmy_api_common::utils::check_validator_time;
|
||||
use lemmy_db_schema::{
|
||||
source::{
|
||||
|
|
|
@ -270,6 +270,9 @@ pub fn build_user_agent(settings: &Settings) -> String {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#![allow(clippy::unwrap_used)]
|
||||
#![allow(clippy::indexing_slicing)]
|
||||
|
||||
use crate::request::{
|
||||
build_user_agent,
|
||||
fetch_site_metadata,
|
||||
|
|
|
@ -731,6 +731,9 @@ pub async fn delete_user_account(
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#![allow(clippy::unwrap_used)]
|
||||
#![allow(clippy::indexing_slicing)]
|
||||
|
||||
use crate::utils::{honeypot_check, password_length_check};
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -183,6 +183,9 @@ fn validate_create_payload(local_site: &LocalSite, create_site: &CreateSite) ->
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#![allow(clippy::unwrap_used)]
|
||||
#![allow(clippy::indexing_slicing)]
|
||||
|
||||
use crate::site::create::validate_create_payload;
|
||||
use lemmy_api_common::site::CreateSite;
|
||||
use lemmy_db_schema::{source::local_site::LocalSite, ListingType, RegistrationMode};
|
||||
|
|
|
@ -42,6 +42,9 @@ pub fn application_question_check(
|
|||
|
||||
#[cfg(test)]
|
||||
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};
|
||||
|
||||
|
|
|
@ -217,6 +217,9 @@ fn validate_update_payload(local_site: &LocalSite, edit_site: &EditSite) -> Lemm
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#![allow(clippy::unwrap_used)]
|
||||
#![allow(clippy::indexing_slicing)]
|
||||
|
||||
use crate::site::update::validate_update_payload;
|
||||
use lemmy_api_common::site::EditSite;
|
||||
use lemmy_db_schema::{source::local_site::LocalSite, ListingType, RegistrationMode};
|
||||
|
|
|
@ -134,6 +134,9 @@ impl InCommunity for AnnouncableActivities {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#![allow(clippy::unwrap_used)]
|
||||
#![allow(clippy::indexing_slicing)]
|
||||
|
||||
use crate::{
|
||||
activity_lists::{
|
||||
GroupInboxActivities,
|
||||
|
|
|
@ -100,6 +100,9 @@ impl Collection for ApubCommunityModerators {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#![allow(clippy::unwrap_used)]
|
||||
#![allow(clippy::indexing_slicing)]
|
||||
|
||||
use super::*;
|
||||
use crate::{
|
||||
objects::{
|
||||
|
|
|
@ -179,6 +179,9 @@ impl Object for ApubComment {
|
|||
|
||||
#[cfg(test)]
|
||||
pub(crate) mod tests {
|
||||
#![allow(clippy::unwrap_used)]
|
||||
#![allow(clippy::indexing_slicing)]
|
||||
|
||||
use super::*;
|
||||
use crate::{
|
||||
objects::{
|
||||
|
|
|
@ -204,6 +204,9 @@ impl ApubCommunity {
|
|||
|
||||
#[cfg(test)]
|
||||
pub(crate) mod tests {
|
||||
#![allow(clippy::unwrap_used)]
|
||||
#![allow(clippy::indexing_slicing)]
|
||||
|
||||
use super::*;
|
||||
use crate::{
|
||||
objects::{instance::tests::parse_lemmy_instance, tests::init_context},
|
||||
|
|
|
@ -206,6 +206,9 @@ pub(crate) async fn remote_instance_inboxes(pool: &mut DbPool<'_>) -> Result<Vec
|
|||
|
||||
#[cfg(test)]
|
||||
pub(crate) mod tests {
|
||||
#![allow(clippy::unwrap_used)]
|
||||
#![allow(clippy::indexing_slicing)]
|
||||
|
||||
use super::*;
|
||||
use crate::{objects::tests::init_context, protocol::tests::file_to_json_object};
|
||||
use lemmy_db_schema::traits::Crud;
|
||||
|
|
|
@ -54,6 +54,9 @@ pub(crate) fn verify_is_remote_object(id: &Url, settings: &Settings) -> Result<(
|
|||
|
||||
#[cfg(test)]
|
||||
pub(crate) mod tests {
|
||||
#![allow(clippy::unwrap_used)]
|
||||
#![allow(clippy::indexing_slicing)]
|
||||
|
||||
use activitypub_federation::config::{Data, FederationConfig};
|
||||
use anyhow::anyhow;
|
||||
use lemmy_api_common::{context::LemmyContext, request::build_user_agent};
|
||||
|
|
|
@ -195,6 +195,9 @@ impl Actor for ApubPerson {
|
|||
|
||||
#[cfg(test)]
|
||||
pub(crate) mod tests {
|
||||
#![allow(clippy::unwrap_used)]
|
||||
#![allow(clippy::indexing_slicing)]
|
||||
|
||||
use super::*;
|
||||
use crate::{
|
||||
objects::{
|
||||
|
|
|
@ -280,6 +280,9 @@ impl Object for ApubPost {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#![allow(clippy::unwrap_used)]
|
||||
#![allow(clippy::indexing_slicing)]
|
||||
|
||||
use super::*;
|
||||
use crate::{
|
||||
objects::{
|
||||
|
|
|
@ -136,6 +136,9 @@ impl Object for ApubPrivateMessage {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#![allow(clippy::unwrap_used)]
|
||||
#![allow(clippy::indexing_slicing)]
|
||||
|
||||
use super::*;
|
||||
use crate::{
|
||||
objects::{
|
||||
|
|
|
@ -3,6 +3,9 @@ pub mod undo_block_user;
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#![allow(clippy::unwrap_used)]
|
||||
#![allow(clippy::indexing_slicing)]
|
||||
|
||||
use crate::protocol::{
|
||||
activities::block::{block_user::BlockUser, undo_block_user::UndoBlockUser},
|
||||
tests::test_parse_lemmy_item,
|
||||
|
|
|
@ -7,6 +7,9 @@ pub mod update;
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#![allow(clippy::unwrap_used)]
|
||||
#![allow(clippy::indexing_slicing)]
|
||||
|
||||
use crate::protocol::{
|
||||
activities::community::{
|
||||
announce::AnnounceActivity,
|
||||
|
|
|
@ -4,6 +4,9 @@ pub mod page;
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#![allow(clippy::unwrap_used)]
|
||||
#![allow(clippy::indexing_slicing)]
|
||||
|
||||
use crate::protocol::{
|
||||
activities::create_or_update::{
|
||||
chat_message::CreateOrUpdateChatMessage,
|
||||
|
|
|
@ -4,6 +4,9 @@ pub mod undo_delete;
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#![allow(clippy::unwrap_used)]
|
||||
#![allow(clippy::indexing_slicing)]
|
||||
|
||||
use crate::protocol::{
|
||||
activities::deletion::{delete::Delete, delete_user::DeleteUser, undo_delete::UndoDelete},
|
||||
tests::test_parse_lemmy_item,
|
||||
|
|
|
@ -4,6 +4,9 @@ pub mod undo_follow;
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#![allow(clippy::unwrap_used)]
|
||||
#![allow(clippy::indexing_slicing)]
|
||||
|
||||
use crate::protocol::{
|
||||
activities::following::{accept::AcceptFollow, follow::Follow, undo_follow::UndoFollow},
|
||||
tests::test_parse_lemmy_item,
|
||||
|
|
|
@ -16,6 +16,9 @@ pub enum CreateOrUpdateType {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#![allow(clippy::unwrap_used)]
|
||||
#![allow(clippy::indexing_slicing)]
|
||||
|
||||
use crate::protocol::{
|
||||
activities::{
|
||||
community::announce::AnnounceActivity,
|
||||
|
|
|
@ -3,6 +3,9 @@ pub mod vote;
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#![allow(clippy::unwrap_used)]
|
||||
#![allow(clippy::indexing_slicing)]
|
||||
|
||||
use crate::protocol::{
|
||||
activities::voting::{undo_vote::UndoVote, vote::Vote},
|
||||
tests::test_parse_lemmy_item,
|
||||
|
|
|
@ -6,6 +6,9 @@ pub(crate) mod group_outbox;
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#![allow(clippy::unwrap_used)]
|
||||
#![allow(clippy::indexing_slicing)]
|
||||
|
||||
use crate::protocol::{
|
||||
collections::{
|
||||
empty_outbox::EmptyOutbox,
|
||||
|
|
|
@ -89,6 +89,9 @@ pub trait InCommunity {
|
|||
|
||||
#[cfg(test)]
|
||||
pub(crate) mod tests {
|
||||
#![allow(clippy::unwrap_used)]
|
||||
#![allow(clippy::indexing_slicing)]
|
||||
|
||||
use activitypub_federation::protocol::context::WithContext;
|
||||
use assert_json_diff::assert_json_include;
|
||||
use lemmy_utils::error::LemmyError;
|
||||
|
|
|
@ -95,6 +95,9 @@ impl LanguageTag {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#![allow(clippy::unwrap_used)]
|
||||
#![allow(clippy::indexing_slicing)]
|
||||
|
||||
use crate::protocol::{
|
||||
objects::{
|
||||
chat_message::ChatMessage,
|
||||
|
|
|
@ -242,6 +242,9 @@ where
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#![allow(clippy::unwrap_used)]
|
||||
#![allow(clippy::indexing_slicing)]
|
||||
|
||||
use crate::protocol::{objects::page::Page, tests::test_parse_lemmy_item};
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -35,6 +35,9 @@ impl CommentAggregates {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#![allow(clippy::unwrap_used)]
|
||||
#![allow(clippy::indexing_slicing)]
|
||||
|
||||
use crate::{
|
||||
aggregates::comment_aggregates::CommentAggregates,
|
||||
source::{
|
||||
|
|
|
@ -19,6 +19,9 @@ impl CommunityAggregates {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#![allow(clippy::unwrap_used)]
|
||||
#![allow(clippy::indexing_slicing)]
|
||||
|
||||
use crate::{
|
||||
aggregates::community_aggregates::CommunityAggregates,
|
||||
source::{
|
||||
|
|
|
@ -19,6 +19,9 @@ impl PersonAggregates {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#![allow(clippy::unwrap_used)]
|
||||
#![allow(clippy::indexing_slicing)]
|
||||
|
||||
use crate::{
|
||||
aggregates::person_aggregates::PersonAggregates,
|
||||
source::{
|
||||
|
|
|
@ -35,6 +35,9 @@ impl PostAggregates {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#![allow(clippy::unwrap_used)]
|
||||
#![allow(clippy::indexing_slicing)]
|
||||
|
||||
use crate::{
|
||||
aggregates::post_aggregates::PostAggregates,
|
||||
source::{
|
||||
|
|
|
@ -15,6 +15,9 @@ impl SiteAggregates {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#![allow(clippy::unwrap_used)]
|
||||
#![allow(clippy::indexing_slicing)]
|
||||
|
||||
use crate::{
|
||||
aggregates::site_aggregates::SiteAggregates,
|
||||
source::{
|
||||
|
|
|
@ -58,6 +58,9 @@ impl ReceivedActivity {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#![allow(clippy::unwrap_used)]
|
||||
#![allow(clippy::indexing_slicing)]
|
||||
|
||||
use super::*;
|
||||
use crate::utils::build_db_pool_for_tests;
|
||||
use serde_json::json;
|
||||
|
|
|
@ -384,6 +384,9 @@ async fn convert_read_languages(
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#![allow(clippy::unwrap_used)]
|
||||
#![allow(clippy::indexing_slicing)]
|
||||
|
||||
use super::*;
|
||||
use crate::{
|
||||
impls::actor_language::{
|
||||
|
|
|
@ -50,6 +50,9 @@ impl CaptchaAnswer {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#![allow(clippy::unwrap_used)]
|
||||
#![allow(clippy::indexing_slicing)]
|
||||
|
||||
use crate::{
|
||||
source::captcha_answer::{CaptchaAnswer, CaptchaAnswerForm, CheckCaptchaAnswer},
|
||||
utils::build_db_pool_for_tests,
|
||||
|
|
|
@ -251,6 +251,9 @@ impl Saveable for CommentSaved {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#![allow(clippy::unwrap_used)]
|
||||
#![allow(clippy::indexing_slicing)]
|
||||
|
||||
use crate::{
|
||||
newtypes::LanguageId,
|
||||
source::{
|
||||
|
|
|
@ -81,6 +81,9 @@ impl CommentReply {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#![allow(clippy::unwrap_used)]
|
||||
#![allow(clippy::indexing_slicing)]
|
||||
|
||||
use crate::{
|
||||
source::{
|
||||
comment::{Comment, CommentInsertForm},
|
||||
|
|
|
@ -331,6 +331,9 @@ impl ApubActor for Community {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#![allow(clippy::unwrap_used)]
|
||||
#![allow(clippy::indexing_slicing)]
|
||||
|
||||
use crate::{
|
||||
source::{
|
||||
community::{
|
||||
|
|
|
@ -49,6 +49,9 @@ impl FederationAllowList {
|
|||
}
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#![allow(clippy::unwrap_used)]
|
||||
#![allow(clippy::indexing_slicing)]
|
||||
|
||||
use crate::{
|
||||
source::{federation_allowlist::FederationAllowList, instance::Instance},
|
||||
utils::build_db_pool_for_tests,
|
||||
|
|
|
@ -42,6 +42,9 @@ impl Language {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#![allow(clippy::unwrap_used)]
|
||||
#![allow(clippy::indexing_slicing)]
|
||||
|
||||
use crate::{source::language::Language, utils::build_db_pool_for_tests};
|
||||
use serial_test::serial;
|
||||
|
||||
|
|
|
@ -551,6 +551,9 @@ impl Crud for AdminPurgeComment {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#![allow(clippy::unwrap_used)]
|
||||
#![allow(clippy::indexing_slicing)]
|
||||
|
||||
use crate::{
|
||||
source::{
|
||||
comment::{Comment, CommentInsertForm},
|
||||
|
|
|
@ -107,6 +107,9 @@ fn bytes_to_hex(bytes: Vec<u8>) -> String {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#![allow(clippy::unwrap_used)]
|
||||
#![allow(clippy::indexing_slicing)]
|
||||
|
||||
use crate::{
|
||||
source::{
|
||||
instance::Instance,
|
||||
|
|
|
@ -200,6 +200,9 @@ impl PersonFollower {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#![allow(clippy::unwrap_used)]
|
||||
#![allow(clippy::indexing_slicing)]
|
||||
|
||||
use crate::{
|
||||
source::{
|
||||
instance::Instance,
|
||||
|
|
|
@ -82,6 +82,9 @@ impl PersonMention {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#![allow(clippy::unwrap_used)]
|
||||
#![allow(clippy::indexing_slicing)]
|
||||
|
||||
use crate::{
|
||||
source::{
|
||||
comment::{Comment, CommentInsertForm},
|
||||
|
|
|
@ -329,6 +329,9 @@ impl Readable for PostRead {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#![allow(clippy::unwrap_used)]
|
||||
#![allow(clippy::indexing_slicing)]
|
||||
|
||||
use crate::{
|
||||
source::{
|
||||
community::{Community, CommunityInsertForm},
|
||||
|
|
|
@ -91,6 +91,9 @@ impl PrivateMessage {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#![allow(clippy::unwrap_used)]
|
||||
#![allow(clippy::indexing_slicing)]
|
||||
|
||||
use crate::{
|
||||
source::{
|
||||
instance::Instance,
|
||||
|
|
|
@ -406,6 +406,9 @@ where
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#![allow(clippy::unwrap_used)]
|
||||
#![allow(clippy::indexing_slicing)]
|
||||
|
||||
use super::{fuzzy_search, *};
|
||||
use crate::utils::is_email_regex;
|
||||
|
||||
|
|
|
@ -269,6 +269,9 @@ impl JoinView for CommentReportView {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#![allow(clippy::unwrap_used)]
|
||||
#![allow(clippy::indexing_slicing)]
|
||||
|
||||
use crate::comment_report_view::{CommentReportQuery, CommentReportView};
|
||||
use lemmy_db_schema::{
|
||||
aggregates::structs::CommentAggregates,
|
||||
|
|
|
@ -382,6 +382,9 @@ impl JoinView for CommentView {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#![allow(clippy::unwrap_used)]
|
||||
#![allow(clippy::indexing_slicing)]
|
||||
|
||||
use crate::comment_view::{
|
||||
Comment,
|
||||
CommentQuery,
|
||||
|
|
|
@ -265,6 +265,9 @@ impl JoinView for PostReportView {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#![allow(clippy::unwrap_used)]
|
||||
#![allow(clippy::indexing_slicing)]
|
||||
|
||||
use crate::post_report_view::{PostReportQuery, PostReportView};
|
||||
use lemmy_db_schema::{
|
||||
aggregates::structs::PostAggregates,
|
||||
|
|
|
@ -473,6 +473,9 @@ impl JoinView for PostView {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#![allow(clippy::unwrap_used)]
|
||||
#![allow(clippy::indexing_slicing)]
|
||||
|
||||
use crate::post_view::{PostQuery, PostView};
|
||||
use lemmy_db_schema::{
|
||||
aggregates::structs::PostAggregates,
|
||||
|
|
|
@ -148,6 +148,9 @@ impl JoinView for PrivateMessageReportView {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#![allow(clippy::unwrap_used)]
|
||||
#![allow(clippy::indexing_slicing)]
|
||||
|
||||
use crate::private_message_report_view::PrivateMessageReportQuery;
|
||||
use lemmy_db_schema::{
|
||||
source::{
|
||||
|
|
|
@ -160,6 +160,9 @@ impl JoinView for RegistrationApplicationView {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#![allow(clippy::unwrap_used)]
|
||||
#![allow(clippy::indexing_slicing)]
|
||||
|
||||
use crate::registration_application_view::{
|
||||
RegistrationApplicationQuery,
|
||||
RegistrationApplicationView,
|
||||
|
|
|
@ -249,6 +249,8 @@ impl<T> LemmyErrorExt2<T> for Result<T, LemmyError> {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#![allow(clippy::unwrap_used)]
|
||||
#![allow(clippy::indexing_slicing)]
|
||||
use super::*;
|
||||
use actix_web::{body::MessageBody, ResponseError};
|
||||
use std::fs::read_to_string;
|
||||
|
|
|
@ -275,6 +275,9 @@ fn parse_ip(addr: &str) -> Option<IpAddr> {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#![allow(clippy::unwrap_used)]
|
||||
#![allow(clippy::indexing_slicing)]
|
||||
|
||||
#[test]
|
||||
fn test_parse_ip() {
|
||||
let ip_addrs = [
|
||||
|
|
|
@ -237,6 +237,9 @@ fn split_ipv6(ip: Ipv6Addr) -> ([u8; 6], u8, u8) {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#![allow(clippy::unwrap_used)]
|
||||
#![allow(clippy::indexing_slicing)]
|
||||
|
||||
#[test]
|
||||
fn test_split_ipv6() {
|
||||
let ip = std::net::Ipv6Addr::new(
|
||||
|
|
|
@ -18,6 +18,9 @@ pub fn markdown_to_html(text: &str) -> String {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#![allow(clippy::unwrap_used)]
|
||||
#![allow(clippy::indexing_slicing)]
|
||||
|
||||
use crate::utils::markdown::markdown_to_html;
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -135,6 +135,9 @@ pub fn add(markdown_parser: &mut MarkdownIt) {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#![allow(clippy::unwrap_used)]
|
||||
#![allow(clippy::indexing_slicing)]
|
||||
|
||||
use crate::utils::markdown::spoiler_rule::add;
|
||||
use markdown_it::MarkdownIt;
|
||||
|
||||
|
|
|
@ -35,6 +35,9 @@ pub fn scrape_text_for_mentions(text: &str) -> Vec<MentionData> {
|
|||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
#![allow(clippy::unwrap_used)]
|
||||
#![allow(clippy::indexing_slicing)]
|
||||
|
||||
use crate::utils::mention::scrape_text_for_mentions;
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -65,6 +65,9 @@ pub(crate) fn slurs_vec_to_str(slurs: &[&str]) -> String {
|
|||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
#![allow(clippy::unwrap_used)]
|
||||
#![allow(clippy::indexing_slicing)]
|
||||
|
||||
use crate::utils::slurs::{remove_slurs, slur_check, slurs_vec_to_str};
|
||||
use regex::RegexBuilder;
|
||||
|
||||
|
|
|
@ -311,6 +311,9 @@ pub fn check_url_scheme(url: &Option<Url>) -> LemmyResult<()> {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#![allow(clippy::unwrap_used)]
|
||||
#![allow(clippy::indexing_slicing)]
|
||||
|
||||
use super::build_totp_2fa;
|
||||
use crate::{
|
||||
error::LemmyErrorType,
|
||||
|
|
|
@ -17,9 +17,7 @@ cargo clippy --workspace --fix --allow-staged --allow-dirty --tests --all-target
|
|||
-D clippy::get_first \
|
||||
-D clippy::explicit_into_iter_loop \
|
||||
-D clippy::explicit_iter_loop \
|
||||
-D clippy::needless_collect
|
||||
|
||||
cargo clippy --workspace --features console -- \
|
||||
-D clippy::needless_collect \
|
||||
-D clippy::unwrap_used \
|
||||
-D clippy::indexing_slicing
|
||||
|
||||
|
|
|
@ -163,7 +163,7 @@ pub async fn start_lemmy_server() -> Result<(), LemmyError> {
|
|||
let prom_api_metrics = PrometheusMetricsBuilder::new("lemmy_api")
|
||||
.registry(default_registry().clone())
|
||||
.build()
|
||||
.unwrap();
|
||||
.expect("Should always be buildable");
|
||||
|
||||
// Create Http server with websocket support
|
||||
HttpServer::new(move || {
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
// TODO: should really not unwrap everywhere here....
|
||||
#![allow(clippy::unwrap_used)]
|
||||
use actix_web::{rt::System, web, App, HttpResponse, HttpServer, Responder};
|
||||
use lemmy_api_common::context::LemmyContext;
|
||||
use lemmy_utils::settings::structs::PrometheusConfig;
|
||||
|
|
|
@ -401,6 +401,9 @@ fn update_instance_software(conn: &mut PgConnection, user_agent: &str) -> LemmyR
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#![allow(clippy::unwrap_used)]
|
||||
#![allow(clippy::indexing_slicing)]
|
||||
|
||||
use lemmy_routes::nodeinfo::NodeInfo;
|
||||
use reqwest::Client;
|
||||
|
||||
|
|
Loading…
Reference in a new issue