mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-10-01 01:36:12 -04:00
Adding some recommended fixes from nightly clippy. (#4473)
This commit is contained in:
parent
7316dd281a
commit
f3d48f2c2c
@ -967,8 +967,6 @@ mod tests {
|
||||
#![allow(clippy::indexing_slicing)]
|
||||
|
||||
use super::*;
|
||||
use crate::utils::{honeypot_check, limit_expire_time, password_length_check};
|
||||
use chrono::{Days, Utc};
|
||||
use pretty_assertions::assert_eq;
|
||||
use serial_test::serial;
|
||||
|
||||
|
@ -123,10 +123,7 @@ pub(crate) mod tests {
|
||||
use crate::protocol::objects::{group::Group, tombstone::Tombstone};
|
||||
use actix_web::body::to_bytes;
|
||||
use lemmy_db_schema::{
|
||||
source::{
|
||||
community::{Community, CommunityInsertForm},
|
||||
instance::Instance,
|
||||
},
|
||||
source::{community::CommunityInsertForm, instance::Instance},
|
||||
traits::Crud,
|
||||
CommunityVisibility,
|
||||
};
|
||||
|
@ -257,7 +257,7 @@ pub(crate) mod tests {
|
||||
protocol::tests::file_to_json_object,
|
||||
};
|
||||
use activitypub_federation::fetch::collection_id::CollectionId;
|
||||
use lemmy_db_schema::{source::site::Site, traits::Crud};
|
||||
use lemmy_db_schema::source::site::Site;
|
||||
use lemmy_utils::error::LemmyResult;
|
||||
use pretty_assertions::assert_eq;
|
||||
use serial_test::serial;
|
||||
|
@ -218,7 +218,6 @@ pub(in crate::objects) async fn fetch_instance_actor_for_object<T: Into<Url> + C
|
||||
pub(crate) mod tests {
|
||||
use super::*;
|
||||
use crate::protocol::tests::file_to_json_object;
|
||||
use lemmy_db_schema::traits::Crud;
|
||||
use lemmy_utils::error::LemmyResult;
|
||||
use pretty_assertions::assert_eq;
|
||||
use serial_test::serial;
|
||||
|
@ -225,7 +225,7 @@ pub(crate) mod tests {
|
||||
protocol::{objects::instance::Instance, tests::file_to_json_object},
|
||||
};
|
||||
use activitypub_federation::fetch::object_id::ObjectId;
|
||||
use lemmy_db_schema::{source::site::Site, traits::Crud};
|
||||
use lemmy_db_schema::source::site::Site;
|
||||
use lemmy_utils::error::LemmyResult;
|
||||
use pretty_assertions::assert_eq;
|
||||
use serial_test::serial;
|
||||
|
@ -34,7 +34,6 @@ use lemmy_api_common::{
|
||||
},
|
||||
};
|
||||
use lemmy_db_schema::{
|
||||
self,
|
||||
source::{
|
||||
community::Community,
|
||||
local_site::LocalSite,
|
||||
@ -297,7 +296,6 @@ mod tests {
|
||||
community::{tests::parse_lemmy_community, ApubCommunity},
|
||||
instance::ApubSite,
|
||||
person::{tests::parse_lemmy_person, ApubPerson},
|
||||
post::ApubPost,
|
||||
},
|
||||
protocol::tests::file_to_json_object,
|
||||
};
|
||||
|
@ -8,7 +8,6 @@ use activitypub_federation::{config::Data, fetch::object_id::ObjectId};
|
||||
use lemmy_api_common::context::LemmyContext;
|
||||
use lemmy_utils::error::{LemmyError, LemmyErrorType};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::convert::TryFrom;
|
||||
use strum_macros::Display;
|
||||
use url::Url;
|
||||
|
||||
|
@ -306,9 +306,9 @@ impl CommunityLanguage {
|
||||
// tracing::warn!("unique error: {_info:#?}");
|
||||
// _info.constraint_name() should be = "community_language_community_id_language_id_key"
|
||||
return Ok(());
|
||||
} else {
|
||||
insert_res?;
|
||||
}
|
||||
insert_res?;
|
||||
|
||||
Ok(())
|
||||
}) as _
|
||||
})
|
||||
@ -391,27 +391,13 @@ mod tests {
|
||||
|
||||
use super::*;
|
||||
use crate::{
|
||||
impls::actor_language::{
|
||||
convert_read_languages,
|
||||
convert_update_languages,
|
||||
default_post_language,
|
||||
get_conn,
|
||||
CommunityLanguage,
|
||||
DbPool,
|
||||
Language,
|
||||
LanguageId,
|
||||
LocalUserLanguage,
|
||||
QueryDsl,
|
||||
RunQueryDsl,
|
||||
SiteLanguage,
|
||||
},
|
||||
source::{
|
||||
community::{Community, CommunityInsertForm},
|
||||
instance::Instance,
|
||||
local_site::{LocalSite, LocalSiteInsertForm},
|
||||
local_user::{LocalUser, LocalUserInsertForm},
|
||||
person::{Person, PersonInsertForm},
|
||||
site::{Site, SiteInsertForm},
|
||||
site::SiteInsertForm,
|
||||
},
|
||||
traits::Crud,
|
||||
utils::build_db_pool_for_tests,
|
||||
|
@ -248,9 +248,8 @@ pub fn limit_and_offset(
|
||||
Some(page) => {
|
||||
if page < 1 {
|
||||
return Err(QueryBuilderError("Page is < 1".into()));
|
||||
} else {
|
||||
page
|
||||
}
|
||||
page
|
||||
}
|
||||
None => 1,
|
||||
};
|
||||
@ -260,9 +259,8 @@ pub fn limit_and_offset(
|
||||
return Err(QueryBuilderError(
|
||||
format!("Fetch limit is > {FETCH_LIMIT_MAX}").into(),
|
||||
));
|
||||
} else {
|
||||
limit
|
||||
}
|
||||
limit
|
||||
}
|
||||
None => FETCH_LIMIT_DEFAULT,
|
||||
};
|
||||
@ -542,8 +540,7 @@ mod tests {
|
||||
#![allow(clippy::unwrap_used)]
|
||||
#![allow(clippy::indexing_slicing)]
|
||||
|
||||
use super::{fuzzy_search, *};
|
||||
use crate::utils::is_email_regex;
|
||||
use super::*;
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
#[test]
|
||||
|
@ -2,7 +2,7 @@ use cfg_if::cfg_if;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::fmt::Debug;
|
||||
use strum_macros::{Display, EnumIter};
|
||||
#[cfg(feature = "full")]
|
||||
#[cfg(feature = "ts-rs")]
|
||||
use ts_rs::TS;
|
||||
|
||||
#[derive(Display, Debug, Serialize, Deserialize, Clone, PartialEq, Eq, EnumIter, Hash)]
|
||||
|
Loading…
Reference in New Issue
Block a user