style: order imports

This commit is contained in:
2026-05-30 04:50:59 +02:00
parent 76643dce94
commit e55b698cb3
+21 -18
View File
@@ -1,22 +1,25 @@
use std::{
collections::HashMap,
fs,
io::Write,
sync::{Arc, Mutex, mpsc},
};
use axum::{ use axum::{
extract::ws::{Message, WebSocket, WebSocketUpgrade}, Router,
extract::{
State,
ws::{Message, WebSocket, WebSocketUpgrade},
},
response::{Html, IntoResponse}, response::{Html, IntoResponse},
routing::get, routing::get,
Router,
}; };
use std::collections::HashMap; use futures::StreamExt as _;
use axum::extract::State;
use rand::random_bool; use rand::random_bool;
use futures::stream::StreamExt;
use serde_json;
use serde_json::json;
use serde::{Deserialize, Serialize};
use std::fs;
use std::io::Write;
use std::sync::mpsc;
use std::sync::{Mutex, Arc};
use tokio::time::{sleep,Duration};
use regex::Regex; use regex::Regex;
use serde::{Deserialize, Serialize};
use serde_json::json;
use tokio::time::{Duration, sleep};
#[derive(Deserialize,Serialize,Debug,Ord,Eq,PartialEq,PartialOrd,Clone)] #[derive(Deserialize,Serialize,Debug,Ord,Eq,PartialEq,PartialOrd,Clone)]
struct Entry struct Entry
@@ -80,7 +83,7 @@ async fn main() {
let app = Router::new() let app = Router::new()
.route("/", get(index)) .route("/", get(index))
.route("/ws", get(ws_handler)) .route("/ws", get(ws_handler))
.route("/leaderboard", get(leaderboard)) .route("/leaderboard", get(leaderboard))
.with_state(state); .with_state(state);
let listener = tokio::net::TcpListener::bind("0.0.0.0:8084") let listener = tokio::net::TcpListener::bind("0.0.0.0:8084")
@@ -241,10 +244,10 @@ async fn handle_socket
fn validate_name(input: String) -> String { fn validate_name(input: String) -> String {
let input = input.trim(); let input = input.trim();
if input == "null" if input == "null"
{ {
return "anon".to_string(); return "anon".to_string();
} }
// Length check // Length check
if input.is_empty() || input.len() > 32 { if input.is_empty() || input.len() > 32 {
return "anon".to_string(); return "anon".to_string();