From 09e05c9f8e33f51f72b010655f68d6e6c97ecd16 Mon Sep 17 00:00:00 2001 From: Robert Garrett Date: Sat, 18 Oct 2025 11:00:04 -0500 Subject: [PATCH] autofmt --- server/src/main.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/server/src/main.rs b/server/src/main.rs index 1571810..d78dc42 100644 --- a/server/src/main.rs +++ b/server/src/main.rs @@ -78,7 +78,6 @@ async fn websocket(socket: WebSocket, state: Arc) { let mut rx = state.tx.subscribe(); let _ = state.tx.send(format!("{username} joined the lobby!")); - // Read messages broadcast through the server, write them to this socket. // If any error is returned, break the loop to terminate the task. We're // not dealing with them right now. @@ -111,18 +110,18 @@ async fn websocket(socket: WebSocket, state: Arc) { } /// Sets the requested username into buffer `name_out` if it is currently unused in the lobby. -/// +/// /// Check for presence of `name` in `state.user_set`. If taken, the `name_out` out-parameter /// is left unchanged (which should be empty, signaling to the caller that the name is /// unavailable). /// /// If the name is available, it is added to `state.user_set` (thus making it unavailable /// going forward) and written into the `name_out` buffer for use by the caller (non-empty -/// values signal that the name has been accepted for use). +/// values signal that the name has been accepted for use). fn check_username(state: &AppState, name_out: &mut String, name: &str) { // TODO: Return a Result instead of using out-parameters. This isn't C, // we can do better. - let mut user_set= state.user_set.lock().unwrap(); + let mut user_set = state.user_set.lock().unwrap(); if !user_set.contains(name) { user_set.insert(name.to_owned()); name_out.push_str(name);