1
0
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:
Yuki Okushi
2019-09-05 00:04:57 +09:00
committed by GitHub
parent bb639d5fe3
commit f232b6c684
18 changed files with 41 additions and 46 deletions

View File

@ -154,7 +154,7 @@ impl StreamHandler<codec::ChatResponse, io::Error> for ChatClient {
for room in rooms {
println!("{}", room);
}
println!("");
println!();
}
_ => (),
}

View File

@ -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

View File

@ -66,7 +66,7 @@ impl Default for ChatServer {
ChatServer {
sessions: HashMap::new(),
rooms: rooms,
rooms,
rng: rand::thread_rng(),
}
}

View File

@ -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 }
});
}
}