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