aboutsummaryrefslogtreecommitdiffstats
path: root/mumd
diff options
context:
space:
mode:
authorEskil Queseth <eskilq@kth.se>2020-10-17 20:54:12 +0200
committerEskil Queseth <eskilq@kth.se>2020-10-17 20:54:12 +0200
commit7d18be093e0952470591fd130417ad13c941318e (patch)
tree8a908b8daa055a4d729c9431da4c48ed748fd02d /mumd
parent821107122299eebde5da1223ea328f63782ceac9 (diff)
downloadmum-7d18be093e0952470591fd130417ad13c941318e.tar.gz
changes according to feedback
Diffstat (limited to 'mumd')
-rw-r--r--mumd/src/state.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/mumd/src/state.rs b/mumd/src/state.rs
index de74a46..e7b0233 100644
--- a/mumd/src/state.rs
+++ b/mumd/src/state.rs
@@ -364,7 +364,7 @@ impl<'a> ProtoTree<'a> {
walk: &[u32],
) {
match walk {
- [] => unreachable!("nu gick nĂ¥got snett"),
+ [] => unreachable!("shouldn't happen because walks always have at least one element"),
&[node] => {
let pt = self.children.entry(node).or_insert(ProtoTree {
channel: None,
@@ -390,7 +390,7 @@ impl<'a> ProtoTree<'a> {
impl<'a> From<&ProtoTree<'a>> for mumlib::state::Channel {
fn from(tree: &ProtoTree<'a>) -> Self {
- let mut c = mumlib::state::Channel::from(tree.channel.unwrap());
+ let mut channel = mumlib::state::Channel::from(tree.channel.unwrap());
let mut children = tree
.children
.iter()
@@ -401,10 +401,10 @@ impl<'a> From<&ProtoTree<'a>> for mumlib::state::Channel {
)
})
.collect::<Vec<_>>();
- children.sort_by_key(|e| e.0);
- c.children = children.into_iter().map(|e| e.1).collect();
- c.users = tree.users.iter().map(|e| (*e).into()).collect();
- c
+ children.sort_by_key(|e| (e.0, &e.1.name));
+ channel.children = children.into_iter().map(|e| e.1).collect();
+ channel.users = tree.users.iter().map(|e| (*e).into()).collect();
+ channel
}
}
@@ -416,7 +416,7 @@ pub fn into_channel(
let mut channel_lookup = HashMap::new();
- for (_, user) in users {
+ for user in users.values() {
channel_lookup
.entry(user.channel)
.or_insert(Vec::new())