From e5481035a7aa6b4115e29e238b2a1745e8964bc1 Mon Sep 17 00:00:00 2001 From: JustTestingV Date: Fri, 15 Sep 2023 19:31:36 +0300 Subject: [PATCH] formatted namings in user.rs --- src/core/player.rs | 2 +- src/projections/irc/mod.rs | 4 ++-- src/protos/irc/user.rs | 12 ++++++------ src/util/table.rs | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/core/player.rs b/src/core/player.rs index 3457a88..1533941 100644 --- a/src/core/player.rs +++ b/src/core/player.rs @@ -302,7 +302,7 @@ impl Player { player_id, connections: AnonTable::new(), my_rooms: HashMap::new(), - banned_from: HashSet::from([RoomId::from("empty").unwrap()]), + banned_from: HashSet::from([RoomId::from("Empty").unwrap()]), rx, handle, rooms, diff --git a/src/projections/irc/mod.rs b/src/projections/irc/mod.rs index 803118f..43e580b 100644 --- a/src/projections/irc/mod.rs +++ b/src/projections/irc/mod.rs @@ -669,8 +669,8 @@ async fn produce_on_join_cmd_messages( } .write_async(writer) .await?; - let prefixed_members: Vec = room_info.members.iter().map(|member| PrefixedNick::fromPlayerId(member.clone())).collect(); - let non_empty_members: NonEmpty = NonEmpty::from_vec(prefixed_members).unwrap_or(nonempty![PrefixedNick::fromStr(user.nickname.clone())]); + let prefixed_members: Vec = room_info.members.iter().map(|member| PrefixedNick::from_player_id(member.clone())).collect(); + let non_empty_members: NonEmpty = NonEmpty::from_vec(prefixed_members).unwrap_or(nonempty![PrefixedNick::from_str(user.nickname.clone())]); ServerMessage { tags: vec![], diff --git a/src/protos/irc/user.rs b/src/protos/irc/user.rs index 7033fea..e426812 100644 --- a/src/protos/irc/user.rs +++ b/src/protos/irc/user.rs @@ -4,13 +4,13 @@ use crate::core::player::PlayerId; #[derive(Clone, Debug, PartialEq, Eq)] pub enum Prefix { - empty, + Empty, } impl fmt::Display for Prefix { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self { - Prefix::empty => write!(f, ""), + Prefix::Empty => write!(f, ""), } } } @@ -22,11 +22,11 @@ pub struct PrefixedNick { } impl PrefixedNick { - pub fn fromStr(nick: Str) -> PrefixedNick { - PrefixedNick { prefix: Prefix::empty, nick } + pub fn from_str(nick: Str) -> PrefixedNick { + PrefixedNick { prefix: Prefix::Empty, nick } } - pub fn fromPlayerId(id: PlayerId) -> PrefixedNick { - PrefixedNick { prefix: Prefix::empty, nick: id.into_inner() } + pub fn from_player_id(id: PlayerId) -> PrefixedNick { + PrefixedNick { prefix: Prefix::Empty, nick: id.into_inner() } } } \ No newline at end of file diff --git a/src/util/table.rs b/src/util/table.rs index 2d93866..92d2ad7 100644 --- a/src/util/table.rs +++ b/src/util/table.rs @@ -21,7 +21,7 @@ impl AnonTable { pub fn insert(&mut self, value: V) -> Key { let id = self.next; self.next += 1; - self.inner.insert(id, value); // should be always empty + self.inner.insert(id, value); // should be always Empty Key(id) }