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:
@@ -24,7 +24,7 @@ pub async fn project_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(results))
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ pub async fn projects_get(
|
||||
web::Query(ids): web::Query<ProjectIds>,
|
||||
pool: web::Data<PgPool>,
|
||||
) -> Result<HttpResponse, ApiError> {
|
||||
let project_ids = serde_json::from_str::<Vec<ProjectId>>(&*ids.ids)?
|
||||
let project_ids = serde_json::from_str::<Vec<ProjectId>>(&ids.ids)?
|
||||
.into_iter()
|
||||
.map(|x| x.into())
|
||||
.collect();
|
||||
@@ -95,7 +95,7 @@ pub async fn project_get_check(
|
||||
) -> Result<HttpResponse, ApiError> {
|
||||
let slug = info.into_inner().0;
|
||||
|
||||
let id_option = models::ids::base62_impl::parse_base62(&*slug).ok();
|
||||
let id_option = models::ids::base62_impl::parse_base62(&slug).ok();
|
||||
|
||||
let id = if let Some(id) = id_option {
|
||||
let id = sqlx::query!(
|
||||
@@ -745,7 +745,7 @@ pub async fn project_edit(
|
||||
|
||||
if let Some(slug) = slug {
|
||||
let slug_project_id_option: Option<ProjectId> =
|
||||
serde_json::from_str(&*format!("\"{}\"", slug)).ok();
|
||||
serde_json::from_str(&format!("\"{}\"", slug)).ok();
|
||||
if let Some(slug_project_id) = slug_project_id_option {
|
||||
let slug_project_id: database::models::ids::ProjectId =
|
||||
slug_project_id.into();
|
||||
@@ -1006,7 +1006,7 @@ pub async fn project_icon_edit(
|
||||
mut payload: web::Payload,
|
||||
) -> Result<HttpResponse, ApiError> {
|
||||
if let Some(content_type) =
|
||||
crate::util::ext::get_image_content_type(&*ext.ext)
|
||||
crate::util::ext::get_image_content_type(&ext.ext)
|
||||
{
|
||||
let cdn_url = dotenvy::var("CDN_URL")?;
|
||||
let user = get_user_from_headers(req.headers(), &**pool).await?;
|
||||
@@ -1183,7 +1183,7 @@ pub async fn add_gallery_item(
|
||||
mut payload: web::Payload,
|
||||
) -> Result<HttpResponse, ApiError> {
|
||||
if let Some(content_type) =
|
||||
crate::util::ext::get_image_content_type(&*ext.ext)
|
||||
crate::util::ext::get_image_content_type(&ext.ext)
|
||||
{
|
||||
item.validate().map_err(|err| {
|
||||
ApiError::Validation(validation_errors_to_string(err, None))
|
||||
|
||||
Reference in New Issue
Block a user