From be76c2aa51733a0cf495e92659fbcbe527f41149 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustav=20S=C3=B6rn=C3=A4s?= Date: Sun, 6 Jun 2021 23:26:24 +0200 Subject: cargo fmt --- mumd/src/state/channel.rs | 5 +---- mumd/src/state/server.rs | 11 ++++++++--- 2 files changed, 9 insertions(+), 7 deletions(-) (limited to 'mumd/src/state') diff --git a/mumd/src/state/channel.rs b/mumd/src/state/channel.rs index f58ed15..6995e1e 100644 --- a/mumd/src/state/channel.rs +++ b/mumd/src/state/channel.rs @@ -157,10 +157,7 @@ pub fn into_channel( let mut proto_tree = ProtoTree { channel: Some(channels.get(&0).unwrap()), children: HashMap::new(), - users: channel_lookup - .get(&0) - .cloned() - .unwrap_or_default(), + users: channel_lookup.get(&0).cloned().unwrap_or_default(), }; for (walk, channel) in walks { diff --git a/mumd/src/state/server.rs b/mumd/src/state/server.rs index 78a10b9..869940a 100644 --- a/mumd/src/state/server.rs +++ b/mumd/src/state/server.rs @@ -103,15 +103,20 @@ impl Server { /// server.channels.insert(0, channel.clone); /// assert_eq!(server.channel_name("Foobar"), Ok((0, &channel))); /// ``` - pub fn channel_name(&self, channel_name: &str) -> Result<(u32, &Channel), ChannelIdentifierError> { - let matches = self.channels + pub fn channel_name( + &self, + channel_name: &str, + ) -> Result<(u32, &Channel), ChannelIdentifierError> { + let matches = self + .channels .iter() .map(|e| ((*e.0, e.1), e.1.path(&self.channels))) .filter(|e| e.1.ends_with(channel_name)) .collect::>(); Ok(match matches.len() { 0 => { - let soft_matches = self.channels + let soft_matches = self + .channels .iter() .map(|e| ((*e.0, e.1), e.1.path(&self.channels).to_lowercase())) .filter(|e| e.1.ends_with(&channel_name.to_lowercase())) -- cgit v1.2.1