Mercurial > dsp > rdsp
changeset 12:f33b11324cc1
lib: remove Option matching abuse from Mixer::next
The ? operator can be used on both Options and Results.
Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
author | Josef 'Jeff' Sipek <jeffpc@josefsipek.net> |
---|---|
date | Sun, 07 Jun 2020 22:01:50 -0400 |
parents | 21aa4d17601d |
children | 3c783bbe4cda |
files | src/lib/signal/mixer.rs |
diffstat | 1 files changed, 1 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib/signal/mixer.rs Sun Jun 07 21:58:18 2020 -0400 +++ b/src/lib/signal/mixer.rs Sun Jun 07 22:01:50 2020 -0400 @@ -65,10 +65,7 @@ type Item = IQSample; fn next(&mut self) -> Option<Self::Item> { - match (self.lhs.next(), self.rhs.next()) { - (Some(a), Some(b)) => Some(a * b), - _ => None - } + Some(self.lhs.next()? * self.rhs.next()?) } }