You've already forked AstralRinth
forked from didirus/AstralRinth
chore(clippy): enable and fix many stricter lints (#3783)
* chore(clippy): enable and fix many stricter lints These ensure that the codebase uses more idiomatic, performant, and concise language constructions. * chore: make non-Clippy compiler warnings also deny by default
This commit is contained in:
committed by
GitHub
parent
301967d204
commit
f84f8c1c2b
@@ -1,5 +1,3 @@
|
||||
#![allow(dead_code)]
|
||||
|
||||
use super::{
|
||||
api_common::{Api, ApiBuildable},
|
||||
environment::LocalService,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use std::collections::HashMap;
|
||||
use std::{collections::HashMap, fmt::Write};
|
||||
|
||||
use actix_http::StatusCode;
|
||||
use actix_web::{
|
||||
@@ -363,13 +363,13 @@ impl ApiProject for ApiV3 {
|
||||
featured = featured
|
||||
);
|
||||
if let Some(title) = title {
|
||||
url.push_str(&format!("&title={title}"));
|
||||
write!(&mut url, "&title={title}").unwrap();
|
||||
}
|
||||
if let Some(description) = description {
|
||||
url.push_str(&format!("&description={description}"));
|
||||
write!(&mut url, "&description={description}").unwrap();
|
||||
}
|
||||
if let Some(ordering) = ordering {
|
||||
url.push_str(&format!("&ordering={ordering}"));
|
||||
write!(&mut url, "&ordering={ordering}").unwrap();
|
||||
}
|
||||
|
||||
let req = test::TestRequest::post()
|
||||
@@ -394,11 +394,12 @@ impl ApiProject for ApiV3 {
|
||||
);
|
||||
|
||||
for (key, value) in patch {
|
||||
url.push_str(&format!(
|
||||
write!(
|
||||
&mut url,
|
||||
"&{key}={value}",
|
||||
key = key,
|
||||
value = urlencoding::encode(&value)
|
||||
));
|
||||
)
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
let req = test::TestRequest::patch()
|
||||
@@ -593,17 +594,17 @@ impl ApiV3 {
|
||||
let start_date = start_date.to_rfc3339();
|
||||
// let start_date = serde_json::to_string(&start_date).unwrap();
|
||||
let start_date = urlencoding::encode(&start_date);
|
||||
extra_args.push_str(&format!("&start_date={start_date}"));
|
||||
write!(&mut extra_args, "&start_date={start_date}").unwrap();
|
||||
}
|
||||
if let Some(end_date) = end_date {
|
||||
let end_date = end_date.to_rfc3339();
|
||||
// let end_date = serde_json::to_string(&end_date).unwrap();
|
||||
let end_date = urlencoding::encode(&end_date);
|
||||
extra_args.push_str(&format!("&end_date={end_date}"));
|
||||
write!(&mut extra_args, "&end_date={end_date}").unwrap();
|
||||
}
|
||||
if let Some(resolution_minutes) = resolution_minutes {
|
||||
extra_args
|
||||
.push_str(&format!("&resolution_minutes={resolution_minutes}"));
|
||||
write!(&mut extra_args, "&resolution_minutes={resolution_minutes}")
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
let req = test::TestRequest::get()
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#![allow(dead_code)]
|
||||
use serde_json::json;
|
||||
|
||||
use crate::common::{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
use std::collections::HashMap;
|
||||
use std::fmt::Write;
|
||||
|
||||
use super::{
|
||||
ApiV3,
|
||||
@@ -416,32 +417,36 @@ impl ApiVersion for ApiV3 {
|
||||
) -> ServiceResponse {
|
||||
let mut query_string = String::new();
|
||||
if let Some(game_versions) = game_versions {
|
||||
query_string.push_str(&format!(
|
||||
write!(
|
||||
&mut query_string,
|
||||
"&game_versions={}",
|
||||
urlencoding::encode(
|
||||
&serde_json::to_string(&game_versions).unwrap()
|
||||
)
|
||||
));
|
||||
)
|
||||
.unwrap();
|
||||
}
|
||||
if let Some(loaders) = loaders {
|
||||
query_string.push_str(&format!(
|
||||
write!(
|
||||
&mut query_string,
|
||||
"&loaders={}",
|
||||
urlencoding::encode(&serde_json::to_string(&loaders).unwrap())
|
||||
));
|
||||
)
|
||||
.unwrap();
|
||||
}
|
||||
if let Some(featured) = featured {
|
||||
query_string.push_str(&format!("&featured={featured}"));
|
||||
write!(&mut query_string, "&featured={featured}").unwrap();
|
||||
}
|
||||
if let Some(version_type) = version_type {
|
||||
query_string.push_str(&format!("&version_type={version_type}"));
|
||||
write!(&mut query_string, "&version_type={version_type}").unwrap();
|
||||
}
|
||||
if let Some(limit) = limit {
|
||||
let limit = limit.to_string();
|
||||
query_string.push_str(&format!("&limit={limit}"));
|
||||
write!(&mut query_string, "&limit={limit}").unwrap();
|
||||
}
|
||||
if let Some(offset) = offset {
|
||||
let offset = offset.to_string();
|
||||
query_string.push_str(&format!("&offset={offset}"));
|
||||
write!(&mut query_string, "&offset={offset}").unwrap();
|
||||
}
|
||||
|
||||
let req = test::TestRequest::get()
|
||||
|
||||
Reference in New Issue
Block a user