clippy fixes

This commit is contained in:
Robin Appelman 2023-12-29 17:09:11 +01:00
commit 2f81852da1
7 changed files with 18 additions and 18 deletions

View file

@ -26,21 +26,22 @@ pub async fn serve_asset<A: Asset>() -> impl IntoResponse {
pub fn guess_mime(path: &str) -> &'static str { pub fn guess_mime(path: &str) -> &'static str {
if path.ends_with("svg") { if path.ends_with("svg") {
return "image/svg+xml"; "image/svg+xml"
} else if path.ends_with("png") { } else if path.ends_with("png") {
return "image/png"; "image/png"
} else if path.ends_with("webp") { } else if path.ends_with("webp") {
return "image/webp"; "image/webp"
} else if path.ends_with("css") { } else if path.ends_with("css") {
return "text/css"; "text/css"
} else if path.ends_with("wasm") { } else if path.ends_with("wasm") {
return "application/wasm"; "application/wasm"
} else if path.ends_with("js") } else if path.ends_with("js")
|| path.ends_with("ts") || path.ends_with("ts")
|| path.ends_with("jsx") || path.ends_with("jsx")
|| path.ends_with("tsx") || path.ends_with("tsx")
{ {
return "text/javascript"; "text/javascript"
} else {
"text/plain"
} }
return "text/plain";
} }

View file

@ -400,7 +400,7 @@ where
if s.is_empty() { if s.is_empty() {
return Ok(Vec::new()); return Ok(Vec::new());
} }
Ok(s.split(",").map(T::from_str).flatten().collect()) Ok(s.split(',').flat_map(T::from_str).collect())
} }
impl Filter { impl Filter {
@ -445,7 +445,7 @@ impl Filter {
for player in player { for player in player {
write!(&mut players_arr, r#",'{}'"#, player).unwrap(); write!(&mut players_arr, r#",'{}'"#, player).unwrap();
} }
players_arr.push_str("]"); players_arr.push(']');
query query
.inner_join( .inner_join(

View file

@ -82,8 +82,7 @@ async fn main() -> Result<()> {
.expect("Failed to init tracing"); .expect("Failed to init tracing");
let config = args() let config = args()
.skip(1) .nth(1)
.next()
.as_deref() .as_deref()
.map(Config::load) .map(Config::load)
.transpose()? .transpose()?
@ -291,7 +290,7 @@ async fn logout(
) -> impl IntoResponse { ) -> impl IntoResponse {
if let Some(session_cookie) = cookie.as_deref().and_then(|cookie| cookie.get(COOKIE_NAME)) { if let Some(session_cookie) = cookie.as_deref().and_then(|cookie| cookie.get(COOKIE_NAME)) {
if let Ok(Some(cookie)) = app.session_store.load_session(session_cookie.into()).await { if let Ok(Some(cookie)) = app.session_store.load_session(session_cookie.into()).await {
let _ = app.session_store.destroy_session(cookie); let _ = app.session_store.destroy_session(cookie).await;
} }
} }
( (

View file

@ -17,7 +17,7 @@ pub struct DemoListScript;
impl<'a> Index<'a> { impl<'a> Index<'a> {
fn map_list(&self) -> impl Render + 'a { fn map_list(&self) -> impl Render + 'a {
MapList(&self.maps) MapList(self.maps)
} }
fn demo_list(&self) -> impl Render + 'a { fn demo_list(&self) -> impl Render + 'a {
DemoList { demos: self.demos } DemoList { demos: self.demos }
@ -61,9 +61,9 @@ impl Render for MapList<'_> {
let mut first = true; let mut first = true;
for map in self.0 { for map in self.0 {
if !first { if !first {
buffer.push_str(","); buffer.push(',');
} }
buffer.push_str(&map); buffer.push_str(map);
first = false; first = false;
} }
} }

View file

@ -44,7 +44,7 @@ impl Render for PluginSection<'_> {
code { "/tf/addons/sourcemod/plugins/" } code { "/tf/addons/sourcemod/plugins/" }
" on your server." " on your server."
} }
@if let None = self.key { @if self.key.is_none() {
li { li {
"Login to retrieve your api-key." "Login to retrieve your api-key."
} }

View file

@ -16,7 +16,7 @@ pub struct Profile<'a> {
impl<'a> Profile<'a> { impl<'a> Profile<'a> {
fn map_list(&self) -> impl Render + 'a { fn map_list(&self) -> impl Render + 'a {
MapList(&self.maps) MapList(self.maps)
} }
fn demo_list(&self) -> impl Render + 'a { fn demo_list(&self) -> impl Render + 'a {
DemoList { demos: self.demos } DemoList { demos: self.demos }

View file

@ -16,7 +16,7 @@ pub struct Uploads<'a> {
impl<'a> Uploads<'a> { impl<'a> Uploads<'a> {
fn map_list(&self) -> impl Render + 'a { fn map_list(&self) -> impl Render + 'a {
MapList(&self.maps) MapList(self.maps)
} }
fn demo_list(&self) -> impl Render + 'a { fn demo_list(&self) -> impl Render + 'a {
DemoList { demos: self.demos } DemoList { demos: self.demos }