mirror of
https://github.com/actix/examples
synced 2025-06-28 18:00:37 +02:00
Fix clippy warnings (#168)
This commit is contained in:
@ -154,7 +154,7 @@ impl StreamHandler<codec::ChatResponse, io::Error> for ChatClient {
|
||||
for room in rooms {
|
||||
println!("{}", room);
|
||||
}
|
||||
println!("");
|
||||
println!();
|
||||
}
|
||||
_ => (),
|
||||
}
|
||||
|
@ -171,7 +171,7 @@ impl StreamHandler<ws::Message, ws::ProtocolError> for WsChatSession {
|
||||
// send message to chat server
|
||||
self.addr.do_send(server::Message {
|
||||
id: self.id,
|
||||
msg: msg,
|
||||
msg,
|
||||
room: self.room.clone(),
|
||||
})
|
||||
}
|
||||
@ -212,7 +212,7 @@ impl WsChatSession {
|
||||
}
|
||||
|
||||
fn main() -> std::io::Result<()> {
|
||||
let _ = env_logger::init();
|
||||
env_logger::init();
|
||||
let sys = actix::System::new("websocket-example");
|
||||
|
||||
// Start chat server actor
|
||||
|
@ -66,7 +66,7 @@ impl Default for ChatServer {
|
||||
|
||||
ChatServer {
|
||||
sessions: HashMap::new(),
|
||||
rooms: rooms,
|
||||
rooms,
|
||||
rng: rand::thread_rng(),
|
||||
}
|
||||
}
|
||||
|
@ -138,10 +138,10 @@ impl ChatSession {
|
||||
) -> ChatSession {
|
||||
ChatSession {
|
||||
id: 0,
|
||||
addr: addr,
|
||||
addr,
|
||||
hb: Instant::now(),
|
||||
room: "Main".to_owned(),
|
||||
framed: framed,
|
||||
framed,
|
||||
}
|
||||
}
|
||||
|
||||
@ -187,10 +187,8 @@ impl TcpServer {
|
||||
// implement stream handler `StreamHandler<(TcpStream,
|
||||
// net::SocketAddr), io::Error>`
|
||||
TcpServer::create(|ctx| {
|
||||
ctx.add_message_stream(
|
||||
listener.incoming().map_err(|_| ()).map(|s| TcpConnect(s)),
|
||||
);
|
||||
TcpServer { chat: chat }
|
||||
ctx.add_message_stream(listener.incoming().map_err(|_| ()).map(TcpConnect));
|
||||
TcpServer { chat }
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user