aboutsummaryrefslogtreecommitdiffstats
path: root/mumlib
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 /mumlib
parent1af9b90133a8d6102a09102bbd6f726f598c24fc (diff)
parentbe7748be2f1e9d1e88ebd093da9eec16d1ad4049 (diff)
downloadmum-50b322f4ef974765a2948dfb08b1c9e8128b1bed.tar.gz
Merge branch 'main' into noise-gate
Diffstat (limited to 'mumlib')
-rw-r--r--mumlib/src/config.rs2
-rw-r--r--mumlib/src/state.rs18
2 files changed, 12 insertions, 8 deletions
diff --git a/mumlib/src/config.rs b/mumlib/src/config.rs
index 3a2fa27..5987ab9 100644
--- a/mumlib/src/config.rs
+++ b/mumlib/src/config.rs
@@ -138,7 +138,7 @@ impl TryFrom<TOMLConfig> for Config {
.collect()
})
.transpose()?
- .unwrap_or(Vec::new()),
+ .unwrap_or_default(),
})
}
}
diff --git a/mumlib/src/state.rs b/mumlib/src/state.rs
index 0f1cef2..faf0c60 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() {
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
+}