aboutsummaryrefslogtreecommitdiffstats
path: root/mumd/src/state
diff options
context:
space:
mode:
authorKapten Z∅∅m <55669224+default-username-852@users.noreply.github.com>2021-01-04 22:46:58 +0100
committerGitHub <noreply@github.com>2021-01-04 22:46:58 +0100
commit50b322f4ef974765a2948dfb08b1c9e8128b1bed (patch)
tree88d41a434b3a0c242ac7b35c6afefff0f75ee656 /mumd/src/state
parent1af9b90133a8d6102a09102bbd6f726f598c24fc (diff)
parentbe7748be2f1e9d1e88ebd093da9eec16d1ad4049 (diff)
downloadmum-50b322f4ef974765a2948dfb08b1c9e8128b1bed.tar.gz
Merge branch 'main' into noise-gate
Diffstat (limited to 'mumd/src/state')
-rw-r--r--mumd/src/state/channel.rs10
-rw-r--r--mumd/src/state/server.rs2
2 files changed, 6 insertions, 6 deletions
diff --git a/mumd/src/state/channel.rs b/mumd/src/state/channel.rs
index 8bbf919..5b6d669 100644
--- a/mumd/src/state/channel.rs
+++ b/mumd/src/state/channel.rs
@@ -88,7 +88,7 @@ impl<'a> ProtoTree<'a> {
users: Vec::new(),
});
pt.channel = Some(channel);
- pt.users = users.get(&node).map(|e| e.clone()).unwrap_or(Vec::new());
+ pt.users = users.get(&node).cloned().unwrap_or_default();
}
longer => {
self.children
@@ -135,7 +135,7 @@ pub fn into_channel(
for user in users.values() {
channel_lookup
.entry(user.channel())
- .or_insert(Vec::new())
+ .or_insert_with(Vec::new)
.push(user);
}
@@ -148,7 +148,7 @@ pub fn into_channel(
}
walk.reverse();
- if walk.len() > 0 {
+ if !walk.is_empty() {
walks.push((walk, channel));
}
}
@@ -159,8 +159,8 @@ pub fn into_channel(
children: HashMap::new(),
users: channel_lookup
.get(&0)
- .map(|e| e.clone())
- .unwrap_or(Vec::new()),
+ .cloned()
+ .unwrap_or_default(),
};
for (walk, channel) in walks {
diff --git a/mumd/src/state/server.rs b/mumd/src/state/server.rs
index a065df0..8a256b6 100644
--- a/mumd/src/state/server.rs
+++ b/mumd/src/state/server.rs
@@ -107,7 +107,7 @@ impl Server {
}
pub fn username(&self) -> Option<&str> {
- self.username.as_ref().map(|e| e.as_str())
+ self.username.as_deref()
}
pub fn username_mut(&mut self) -> &mut Option<String> {