Fix clippy warnings
This commit is contained in:
parent
4e9784baf4
commit
8427eb082b
3 changed files with 9 additions and 14 deletions
|
@ -47,15 +47,15 @@ impl MessageResponseData {
|
|||
})
|
||||
}
|
||||
|
||||
fn to_response(self) -> MessageResponse {
|
||||
fn into_response(self) -> MessageResponse {
|
||||
MessageResponse {
|
||||
event: self.get_name(),
|
||||
data: self,
|
||||
}
|
||||
}
|
||||
|
||||
fn to_message(self) -> Message {
|
||||
self.to_response().to_message()
|
||||
fn into_message(self) -> Message {
|
||||
self.into_response().to_message()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -89,7 +89,7 @@ impl Server {
|
|||
}
|
||||
|
||||
fn broadcast_player_count(&self) {
|
||||
let response = MessageResponseData::PlayerCount { players: self.clients.len() as u64 }.to_response();
|
||||
let response = MessageResponseData::PlayerCount { players: self.clients.len() as u64 }.into_response();
|
||||
for (_client, responder) in self.clients.iter() {
|
||||
responder.send(response.to_message());
|
||||
}
|
||||
|
@ -97,7 +97,7 @@ impl Server {
|
|||
|
||||
fn handle_connection(&mut self, client_id: u64, responder: Responder) {
|
||||
println!("A client connected with id #{}", client_id);
|
||||
responder.send(MessageResponseData::Greeting { id: client_id }.to_message());
|
||||
responder.send(MessageResponseData::Greeting { id: client_id }.into_message());
|
||||
if let Some(ref last_response) = self.last_response {
|
||||
responder.send(last_response.to_message());
|
||||
}
|
||||
|
@ -160,7 +160,7 @@ impl Server {
|
|||
message: String::from("Not in dictionary!"),
|
||||
},
|
||||
}
|
||||
}.to_response();
|
||||
}.into_response();
|
||||
|
||||
match response.data {
|
||||
// Send errors to only this client
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue