From 2d049e4a9fbac793a87204ebc89d4d476724ba31 Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Fri, 9 Feb 2018 22:46:34 -0800 Subject: [PATCH] update example --- examples/websocket-chat/src/main.rs | 6 +++--- examples/websocket/src/main.rs | 2 +- guide/src/qs_9.md | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/websocket-chat/src/main.rs b/examples/websocket-chat/src/main.rs index 9c9af18e5..0252f141e 100644 --- a/examples/websocket-chat/src/main.rs +++ b/examples/websocket-chat/src/main.rs @@ -87,7 +87,7 @@ impl Handler for WsChatSession { type Result = (); fn handle(&mut self, msg: session::Message, ctx: &mut Self::Context) { - ctx.text(&msg.0); + ctx.text(msg.0); } } @@ -113,7 +113,7 @@ impl Handler for WsChatSession { match res { Ok(Ok(rooms)) => { for room in rooms { - ctx.text(&room); + ctx.text(room); } }, _ => println!("Something is wrong"), @@ -142,7 +142,7 @@ impl Handler for WsChatSession { ctx.text("!!! name is required"); } }, - _ => ctx.text(&format!("!!! unknown command: {:?}", m)), + _ => ctx.text(format!("!!! unknown command: {:?}", m)), } } else { let msg = if let Some(ref name) = self.name { diff --git a/examples/websocket/src/main.rs b/examples/websocket/src/main.rs index 1319a88d8..9149ead71 100644 --- a/examples/websocket/src/main.rs +++ b/examples/websocket/src/main.rs @@ -33,7 +33,7 @@ impl Handler for MyWebSocket { println!("WS: {:?}", msg); match msg { ws::Message::Ping(msg) => ctx.pong(&msg), - ws::Message::Text(text) => ctx.text(&text), + ws::Message::Text(text) => ctx.text(text), ws::Message::Binary(bin) => ctx.binary(bin), ws::Message::Closed | ws::Message::Error => { ctx.stop(); diff --git a/guide/src/qs_9.md b/guide/src/qs_9.md index 32fe7d3b6..dbca38384 100644 --- a/guide/src/qs_9.md +++ b/guide/src/qs_9.md @@ -28,7 +28,7 @@ impl Handler for Ws { fn handle(&mut self, msg: ws::Message, ctx: &mut Self::Context) { match msg { ws::Message::Ping(msg) => ctx.pong(&msg), - ws::Message::Text(text) => ctx.text(&text), + ws::Message::Text(text) => ctx.text(text), ws::Message::Binary(bin) => ctx.binary(bin), _ => (), }