Fixed some clippy lints

This commit is contained in:
2026-05-19 19:34:56 +01:00
parent ee34493895
commit 9255c1d7fa
4 changed files with 19 additions and 26 deletions
+12 -13
View File
@@ -40,9 +40,8 @@ pub async fn api_process
// This data must be passed through to the api route in order to be used
let happening_queue_filter = warp::any().map(move || Arc::clone(&happening_queue));
let characters_filter = warp::any().map(move || Arc::clone(&characters));
let tx_filter = warp::any().map(move || tx.clone());
let tx_filter2 = tx_filter.clone();
let tx_filter3 = tx_filter.clone();
let tx_filter1 = warp::any().map(move || tx.clone());
let tx_filter2 = tx_filter1.clone();
info!("Running server");
@@ -50,13 +49,13 @@ pub async fn api_process
let main = warp::path("happening")
.and(warp::get())
.and(happening_queue_filter)
.and(tx_filter)
// Perform this code on a GET request
.map(|queue: Arc<Mutex<VecDeque<DataToSend>>>, tx_handle: Sender<(usize,String)>|
.map(|queue: Arc<Mutex<VecDeque<DataToSend>>>|
{
//debug!("GET: {state:?}");
let mut queue = queue.lock().unwrap();
let mut queue = queue.lock().unwrap_or_exit("Queue Mutex was poisoned", 2);
let reply = queue.pop_front().unwrap_or_default();
drop(queue);
warp::reply::json(&reply) // Send the reply data (data_to_send formatted as JSON)
}).boxed();
let characters = warp::path("character")
@@ -90,7 +89,7 @@ pub async fn api_process
let choice = warp::path("choice")
.and(warp::post())
.and(warp::body::json())
.and(tx_filter2)
.and(tx_filter1)
.map(|index: usize, tx_handle: Sender<(usize,String)>| {
debug!("Choice: {index}");
let _ = tx_handle.send((index,String::new()));
@@ -100,7 +99,7 @@ pub async fn api_process
let input = warp::path("input")
.and(warp::post())
.and(warp::body::json())
.and(tx_filter3)
.and(tx_filter2)
.map(|input: String, tx_handle: Sender<(usize, String)>|
{
let _ = tx_handle.send((0,input));
@@ -122,16 +121,16 @@ pub fn modify_data // TODO rename
happening_queue: &Arc<Mutex<VecDeque<DataToSend>>>,
action_type: String,
content: String,
character_name: String,
character: String,
choices: Vec<String>,
)
{
let mut queue = happening_queue.lock().unwrap_or_exit("Data to send Mutex was poisoned",2);
let new_data = DataToSend {
action_type: action_type,
content: content,
character: character_name,
choices: choices,
action_type,
content,
character,
choices,
};
queue.push_back(new_data);
drop(queue);