1
0
mirror of https://github.com/actix/examples synced 2025-06-26 17:17:42 +02:00

s/str::to_string/str::to_owned

This commit is contained in:
Rob Ede
2023-07-09 03:32:47 +01:00
parent 9a5cd90634
commit 8fd4262136
14 changed files with 26 additions and 29 deletions

View File

@ -76,7 +76,7 @@ impl Handler<JoinRoom> for WsChatServer {
let id = self.add_client_to_room(&room_name, None, client);
let join_msg = format!(
"{} joined {room_name}",
client_name.unwrap_or_else(|| "anon".to_string()),
client_name.unwrap_or_else(|| "anon".to_owned()),
);
self.send_chat_message(&room_name, &join_msg, id);

View File

@ -64,7 +64,7 @@ impl WsChatSession {
pub fn send_msg(&self, msg: &str) {
let content = format!(
"{}: {msg}",
self.name.clone().unwrap_or_else(|| "anon".to_string()),
self.name.clone().unwrap_or_else(|| "anon".to_owned()),
);
let msg = SendMessage(self.room.clone(), self.id, content);
@ -84,7 +84,7 @@ impl Actor for WsChatSession {
fn stopped(&mut self, _ctx: &mut Self::Context) {
log::info!(
"WsChatSession closed for {}({}) in room {}",
self.name.clone().unwrap_or_else(|| "anon".to_string()),
self.name.clone().unwrap_or_else(|| "anon".to_owned()),
self.id,
self.room
);