diff options
| author | Gustav Sörnäs <gustav@sornas.net> | 2021-01-02 18:47:10 +0100 |
|---|---|---|
| committer | Gustav Sörnäs <gustav@sornas.net> | 2021-01-02 18:47:10 +0100 |
| commit | be7748be2f1e9d1e88ebd093da9eec16d1ad4049 (patch) | |
| tree | 14c118236500a6ffff99bedd1487a7d2cbca009c /mumlib/src | |
| parent | 28f0ccd4639865e10690022c8164ba4c5b337102 (diff) | |
| parent | 1c8b7316503d3ab710d3d3ec241b85e76b9a42be (diff) | |
| download | mum-be7748be2f1e9d1e88ebd093da9eec16d1ad4049.tar.gz | |
Merge remote-tracking branch 'origin/clippy' into main
Diffstat (limited to 'mumlib/src')
| -rw-r--r-- | mumlib/src/config.rs | 2 | ||||
| -rw-r--r-- | mumlib/src/state.rs | 18 |
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 +} |
