diff options
| author | Gustav Sörnäs <gustav@sornas.net> | 2021-01-01 22:32:12 +0100 |
|---|---|---|
| committer | Gustav Sörnäs <gustav@sornas.net> | 2021-01-01 22:40:08 +0100 |
| commit | 1c8b7316503d3ab710d3d3ec241b85e76b9a42be (patch) | |
| tree | 95e85a9f7bd26b6901e6cbe5e9ca29f8d60053e5 /mumlib | |
| parent | 67364577263943e815be9ba700c10845698e116d (diff) | |
| download | mum-1c8b7316503d3ab710d3d3ec241b85e76b9a42be.tar.gz | |
clippy pass
Diffstat (limited to 'mumlib')
| -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..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 +} |
