mirror of
https://codeberg.org/demostf/frontend.git
synced 2026-06-03 10:14:13 +02:00
clippy fixes
This commit is contained in:
parent
51d155d1a8
commit
2f81852da1
7 changed files with 18 additions and 18 deletions
15
src/asset.rs
15
src/asset.rs
|
|
@ -26,21 +26,22 @@ pub async fn serve_asset<A: Asset>() -> impl IntoResponse {
|
|||
|
||||
pub fn guess_mime(path: &str) -> &'static str {
|
||||
if path.ends_with("svg") {
|
||||
return "image/svg+xml";
|
||||
"image/svg+xml"
|
||||
} else if path.ends_with("png") {
|
||||
return "image/png";
|
||||
"image/png"
|
||||
} else if path.ends_with("webp") {
|
||||
return "image/webp";
|
||||
"image/webp"
|
||||
} else if path.ends_with("css") {
|
||||
return "text/css";
|
||||
"text/css"
|
||||
} else if path.ends_with("wasm") {
|
||||
return "application/wasm";
|
||||
"application/wasm"
|
||||
} else if path.ends_with("js")
|
||||
|| path.ends_with("ts")
|
||||
|| path.ends_with("jsx")
|
||||
|| path.ends_with("tsx")
|
||||
{
|
||||
return "text/javascript";
|
||||
"text/javascript"
|
||||
} else {
|
||||
"text/plain"
|
||||
}
|
||||
return "text/plain";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -400,7 +400,7 @@ where
|
|||
if s.is_empty() {
|
||||
return Ok(Vec::new());
|
||||
}
|
||||
Ok(s.split(",").map(T::from_str).flatten().collect())
|
||||
Ok(s.split(',').flat_map(T::from_str).collect())
|
||||
}
|
||||
|
||||
impl Filter {
|
||||
|
|
@ -445,7 +445,7 @@ impl Filter {
|
|||
for player in player {
|
||||
write!(&mut players_arr, r#",'{}'"#, player).unwrap();
|
||||
}
|
||||
players_arr.push_str("]");
|
||||
players_arr.push(']');
|
||||
|
||||
query
|
||||
.inner_join(
|
||||
|
|
|
|||
|
|
@ -82,8 +82,7 @@ async fn main() -> Result<()> {
|
|||
.expect("Failed to init tracing");
|
||||
|
||||
let config = args()
|
||||
.skip(1)
|
||||
.next()
|
||||
.nth(1)
|
||||
.as_deref()
|
||||
.map(Config::load)
|
||||
.transpose()?
|
||||
|
|
@ -291,7 +290,7 @@ async fn logout(
|
|||
) -> impl IntoResponse {
|
||||
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 {
|
||||
let _ = app.session_store.destroy_session(cookie);
|
||||
let _ = app.session_store.destroy_session(cookie).await;
|
||||
}
|
||||
}
|
||||
(
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ pub struct DemoListScript;
|
|||
|
||||
impl<'a> Index<'a> {
|
||||
fn map_list(&self) -> impl Render + 'a {
|
||||
MapList(&self.maps)
|
||||
MapList(self.maps)
|
||||
}
|
||||
fn demo_list(&self) -> impl Render + 'a {
|
||||
DemoList { demos: self.demos }
|
||||
|
|
@ -61,9 +61,9 @@ impl Render for MapList<'_> {
|
|||
let mut first = true;
|
||||
for map in self.0 {
|
||||
if !first {
|
||||
buffer.push_str(",");
|
||||
buffer.push(',');
|
||||
}
|
||||
buffer.push_str(&map);
|
||||
buffer.push_str(map);
|
||||
first = false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ impl Render for PluginSection<'_> {
|
|||
code { "/tf/addons/sourcemod/plugins/" }
|
||||
" on your server."
|
||||
}
|
||||
@if let None = self.key {
|
||||
@if self.key.is_none() {
|
||||
li {
|
||||
"Login to retrieve your api-key."
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ pub struct Profile<'a> {
|
|||
|
||||
impl<'a> Profile<'a> {
|
||||
fn map_list(&self) -> impl Render + 'a {
|
||||
MapList(&self.maps)
|
||||
MapList(self.maps)
|
||||
}
|
||||
fn demo_list(&self) -> impl Render + 'a {
|
||||
DemoList { demos: self.demos }
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ pub struct Uploads<'a> {
|
|||
|
||||
impl<'a> Uploads<'a> {
|
||||
fn map_list(&self) -> impl Render + 'a {
|
||||
MapList(&self.maps)
|
||||
MapList(self.maps)
|
||||
}
|
||||
fn demo_list(&self) -> impl Render + 'a {
|
||||
DemoList { demos: self.demos }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue