You've already forked AstralRinth
forked from didirus/AstralRinth
Fix all default clippy warnings (#480)
All trivial, fixes were for: - #[deny(clippy::if_same_then_else)] - #[warn(clippy::explicit_auto_deref)] - #[warn(clippy::bool_assert_comparison)] Co-authored-by: Geometrically <18202329+Geometrically@users.noreply.github.com>
This commit is contained in:
@@ -52,7 +52,7 @@ pub async fn mod_search(
|
||||
web::Query(info): web::Query<SearchRequest>,
|
||||
config: web::Data<SearchConfig>,
|
||||
) -> Result<HttpResponse, SearchError> {
|
||||
let results = search_for_project(&info, &**config).await?;
|
||||
let results = search_for_project(&info, &config).await?;
|
||||
Ok(HttpResponse::Ok().json(SearchResults {
|
||||
hits: results
|
||||
.hits
|
||||
@@ -92,7 +92,7 @@ pub async fn mods_get(
|
||||
pool: web::Data<PgPool>,
|
||||
) -> Result<HttpResponse, ApiError> {
|
||||
let project_ids =
|
||||
serde_json::from_str::<Vec<models::ids::ProjectId>>(&*ids.ids)?
|
||||
serde_json::from_str::<Vec<models::ids::ProjectId>>(&ids.ids)?
|
||||
.into_iter()
|
||||
.map(|x| x.into())
|
||||
.collect();
|
||||
|
||||
@@ -74,7 +74,7 @@ pub async fn report_create(
|
||||
let id =
|
||||
crate::database::models::generate_report_id(&mut transaction).await?;
|
||||
let report_type = crate::database::models::categories::ReportType::get_id(
|
||||
&*new_report.report_type,
|
||||
&new_report.report_type,
|
||||
&mut *transaction,
|
||||
)
|
||||
.await?
|
||||
@@ -98,7 +98,7 @@ pub async fn report_create(
|
||||
match new_report.item_type {
|
||||
ItemType::Mod => {
|
||||
report.project_id = Some(
|
||||
serde_json::from_str::<ProjectId>(&*format!(
|
||||
serde_json::from_str::<ProjectId>(&format!(
|
||||
"\"{}\"",
|
||||
new_report.item_id
|
||||
))?
|
||||
@@ -107,7 +107,7 @@ pub async fn report_create(
|
||||
}
|
||||
ItemType::Version => {
|
||||
report.version_id = Some(
|
||||
serde_json::from_str::<VersionId>(&*format!(
|
||||
serde_json::from_str::<VersionId>(&format!(
|
||||
"\"{}\"",
|
||||
new_report.item_id
|
||||
))?
|
||||
@@ -116,7 +116,7 @@ pub async fn report_create(
|
||||
}
|
||||
ItemType::User => {
|
||||
report.user_id = Some(
|
||||
serde_json::from_str::<UserId>(&*format!(
|
||||
serde_json::from_str::<UserId>(&format!(
|
||||
"\"{}\"",
|
||||
new_report.item_id
|
||||
))?
|
||||
|
||||
@@ -86,7 +86,7 @@ pub async fn loader_create(
|
||||
.name(&name)?
|
||||
.icon(DEFAULT_ICON)?
|
||||
.supported_project_types(
|
||||
&*project_types.into_iter().map(|x| x.id).collect::<Vec<_>>(),
|
||||
&project_types.into_iter().map(|x| x.id).collect::<Vec<_>>(),
|
||||
)?
|
||||
.insert(&mut transaction)
|
||||
.await?;
|
||||
|
||||
@@ -16,7 +16,7 @@ pub async fn mods_list(
|
||||
let user = get_user_from_headers(req.headers(), &**pool).await.ok();
|
||||
|
||||
let id_option = crate::database::models::User::get_id_from_username_or_id(
|
||||
&*info.into_inner().0,
|
||||
&info.into_inner().0,
|
||||
&**pool,
|
||||
)
|
||||
.await?;
|
||||
@@ -59,7 +59,7 @@ pub async fn user_follows(
|
||||
) -> Result<HttpResponse, ApiError> {
|
||||
let user = get_user_from_headers(req.headers(), &**pool).await?;
|
||||
let id_option = crate::database::models::User::get_id_from_username_or_id(
|
||||
&*info.into_inner().0,
|
||||
&info.into_inner().0,
|
||||
&**pool,
|
||||
)
|
||||
.await?;
|
||||
|
||||
@@ -159,7 +159,7 @@ pub async fn versions_get(
|
||||
ids: web::Query<VersionIds>,
|
||||
pool: web::Data<PgPool>,
|
||||
) -> Result<HttpResponse, ApiError> {
|
||||
let version_ids = serde_json::from_str::<Vec<VersionId>>(&*ids.ids)?
|
||||
let version_ids = serde_json::from_str::<Vec<VersionId>>(&ids.ids)?
|
||||
.into_iter()
|
||||
.map(|x| x.into())
|
||||
.collect();
|
||||
|
||||
Reference in New Issue
Block a user