aboutsummaryrefslogtreecommitdiffstats
path: root/mumlib/src/state.rs
diff options
context:
space:
mode:
Diffstat (limited to 'mumlib/src/state.rs')
-rw-r--r--mumlib/src/state.rs18
1 files changed, 11 insertions, 7 deletions
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
+}