diff options
| author | Fuwn <[email protected]> | 2024-06-03 15:37:20 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2024-06-03 15:37:20 -0700 |
| commit | 714d9b3cf1851ffe02424f0742126d3e82c76ccb (patch) | |
| tree | c9ab6b0f57ec91e351bcc5cadf33de925b136048 /crates/whirl_server/src/distributor.rs | |
| parent | format: rustfmt with new rules (diff) | |
| download | whirl-714d9b3cf1851ffe02424f0742126d3e82c76ccb.tar.xz whirl-714d9b3cf1851ffe02424f0742126d3e82c76ccb.zip | |
refactor(crates): update idioms
Diffstat (limited to 'crates/whirl_server/src/distributor.rs')
| -rw-r--r-- | crates/whirl_server/src/distributor.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/crates/whirl_server/src/distributor.rs b/crates/whirl_server/src/distributor.rs index cf9acbf..e89b8d8 100644 --- a/crates/whirl_server/src/distributor.rs +++ b/crates/whirl_server/src/distributor.rs @@ -67,7 +67,7 @@ impl Server for Distributor { result = peer.bytes.next() => match result { Some(Ok(msg)) => { for msg in parse_commands_from_packet(msg) { - match num_traits::FromPrimitive::from_i32(msg.get(2).unwrap().to_owned() as i32) { + match num_traits::FromPrimitive::from_i32(i32::from(msg.get(2).unwrap().to_owned())) { Some(Command::PropReq) => { debug!("received property request from client"); @@ -76,9 +76,9 @@ impl Server for Distributor { trace!("sent property update to client"); } Some(Command::SessInit) => { - username = (*crate::net::property_list::PropertyList::from_bytes(msg[3..] + username = crate::net::property_list::PropertyList::from_bytes(msg[3..] .to_vec()) - .find(VAR_USERNAME)).value.to_string(); + .find(VAR_USERNAME).value.to_string(); debug!("received session initialization from {}", username); @@ -114,13 +114,13 @@ impl Server for Distributor { trace!("found room: {}", room.room_name); room_id = position; } else { - room_ids.push((&*room.room_name).to_string()); + room_ids.push((*room.room_name).to_string()); room_id = room_ids.iter().position(|r| r == &room.room_name).unwrap(); trace!("inserted room {}: {}", room.room_name, room_id); } peer.bytes.get_mut().write_all(&RedirectId { - room_name: (&*room.room_name).to_string(), + room_name: (*room.room_name).to_string(), room_number: room_id as i8, }.create()).await?; trace!("sent redirect id to {}: {}", username, room.room_name); |