From 1c8b7316503d3ab710d3d3ec241b85e76b9a42be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustav=20S=C3=B6rn=C3=A4s?= Date: Fri, 1 Jan 2021 22:32:12 +0100 Subject: clippy pass --- mumlib/src/state.rs | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'mumlib/src/state.rs') diff --git a/mumlib/src/state.rs b/mumlib/src/state.rs index 0f1cef2..9c71b47 100644 --- a/mumlib/src/state.rs +++ b/mumlib/src/state.rs @@ -24,10 +24,10 @@ impl Channel { pub fn iter(&self) -> Iter<'_> { Iter { me: Some(&self), - channel: if self.children.len() > 0 { - Some(0) - } else { + channel: if self.children.is_empty() { None + } else { + Some(0) }, channels: self.children.iter().map(|e| e.iter()).collect(), } @@ -36,12 +36,16 @@ impl Channel { pub fn users_iter(&self) -> UsersIter<'_> { UsersIter { channels: self.children.iter().map(|e| e.users_iter()).collect(), - channel: if self.children.len() > 0 { - Some(0) + channel: if self.children.is_empty() { + None } else { + Some(0) + }, + user: if self.users.is_empty() > 0 { None + } else { + Some(0) }, - user: if self.users.len() > 0 { Some(0) } else { None }, users: &self.users, } } @@ -152,4 +156,4 @@ impl Display for User { true_to_str!(self.deaf, "d") ) } -} \ No newline at end of file +} -- cgit v1.2.1