aboutsummaryrefslogtreecommitdiff
path: root/crates/whirl_server/src/interaction
diff options
context:
space:
mode:
authorFuwn <[email protected]>2021-05-28 00:06:40 -0700
committerFuwn <[email protected]>2021-05-28 00:06:40 -0700
commit179ce3277ece536cae41b834469f4065e3600d82 (patch)
treea96d55a34531c9761f6309c35f8d9cfab9879db6 /crates/whirl_server/src/interaction
parentMerge branch 'develop' of https://github.com/Whirlsplash/whirl into develop (diff)
downloadwhirl-179ce3277ece536cae41b834469f4065e3600d82.tar.xz
whirl-179ce3277ece536cae41b834469f4065e3600d82.zip
fix(global): a lot of clippy warnings
This change makes clippy **a lot** more strict.
Diffstat (limited to 'crates/whirl_server/src/interaction')
-rw-r--r--crates/whirl_server/src/interaction/peer.rs4
-rw-r--r--crates/whirl_server/src/interaction/shared.rs4
2 files changed, 4 insertions, 4 deletions
diff --git a/crates/whirl_server/src/interaction/peer.rs b/crates/whirl_server/src/interaction/peer.rs
index 38c02c5..6a04b17 100644
--- a/crates/whirl_server/src/interaction/peer.rs
+++ b/crates/whirl_server/src/interaction/peer.rs
@@ -20,11 +20,11 @@ impl Peer {
state: Arc<Mutex<Shared>>,
bytes: Framed<TcpStream, BytesCodec>,
username: String,
- ) -> std::io::Result<Peer> {
+ ) -> std::io::Result<Self> {
let (tx, rx) = mpsc::unbounded_channel();
state.lock().await.peers.insert(username, tx);
- Ok(Peer {
+ Ok(Self {
bytes,
rx,
})
diff --git a/crates/whirl_server/src/interaction/shared.rs b/crates/whirl_server/src/interaction/shared.rs
index c2ee671..7ad2510 100644
--- a/crates/whirl_server/src/interaction/shared.rs
+++ b/crates/whirl_server/src/interaction/shared.rs
@@ -12,13 +12,13 @@ pub struct Shared {
}
impl Shared {
pub fn new() -> Self {
- Shared {
+ Self {
peers: HashMap::new(),
}
}
pub async fn broadcast(&mut self, message: &[u8]) {
- for peer in self.peers.iter_mut() {
+ for peer in &mut self.peers {
peer.1.send(BytesMut::from(message)).unwrap();
}
}