Skip to content

Commit

Permalink
Make rustfmt happy
Browse files Browse the repository at this point in the history
  • Loading branch information
skade committed May 23, 2024
1 parent 6f69d4f commit 23e7add
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
4 changes: 2 additions & 2 deletions exercise-solutions/async-chat/src/client.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use tokio::{
io::{stdin, BufReader, AsyncBufReadExt, AsyncWriteExt},
io::{stdin, AsyncBufReadExt, AsyncWriteExt, BufReader},
net::{TcpStream, ToSocketAddrs},
};

Expand Down Expand Up @@ -38,4 +38,4 @@ async fn try_main(addr: impl ToSocketAddrs) -> Result<()> {
}
}
Ok(())
}
}
2 changes: 1 addition & 1 deletion exercise-solutions/async-chat/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ fn main() -> Result<()> {
(Some("server"), None) => server::main(),
_ => Err("Usage: a-chat [client|server]".into()),
}
}
}
15 changes: 7 additions & 8 deletions exercise-solutions/async-chat/src/server.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
use std::{
collections::hash_map::{Entry, HashMap},
sync::Arc,
future::Future,
sync::Arc,
};

use tokio::sync::mpsc;

use tokio::{
io::{BufReader,AsyncWriteExt, AsyncBufReadExt},
net::{TcpListener, TcpStream, ToSocketAddrs},
io::{AsyncBufReadExt, AsyncWriteExt, BufReader},
net::tcp::{OwnedReadHalf, OwnedWriteHalf},
net::{TcpListener, TcpStream, ToSocketAddrs},
task,
};

Expand Down Expand Up @@ -159,10 +159,9 @@ async fn broker_loop(mut events: Receiver<Event>) {
let mut disconnect_sender = disconnect_sender.clone();
spawn_and_log_error(async move {
let res =
connection_writer_loop(&mut client_receiver, &mut stream, shutdown).await;
disconnect_sender
.send((name, client_receiver))
.unwrap();
connection_writer_loop(&mut client_receiver, &mut stream, shutdown)
.await;
disconnect_sender.send((name, client_receiver)).unwrap();
res
});
}
Expand All @@ -183,4 +182,4 @@ where
eprintln!("{}", e)
}
})
}
}

0 comments on commit 23e7add

Please sign in to comment.