diff options
Diffstat (limited to 'src/tests')
-rw-r--r-- | src/tests/fakes/fake_input.rs | 39 |
1 files changed, 16 insertions, 23 deletions
diff --git a/src/tests/fakes/fake_input.rs b/src/tests/fakes/fake_input.rs index 1cd5fa4..831d4fb 100644 --- a/src/tests/fakes/fake_input.rs +++ b/src/tests/fakes/fake_input.rs @@ -22,15 +22,13 @@ impl Iterator for KeyboardEvents { type Item = Event; fn next(&mut self) -> Option<Event> { match self.events.pop() { - Some(ev) => { - match ev { - Some(ev) => Some(ev), - None => { - thread::sleep(time::Duration::from_secs(1)); - self.next() - } + Some(ev) => match ev { + Some(ev) => Some(ev), + None => { + thread::sleep(time::Duration::from_secs(1)); + self.next() } - } + }, None => None, } } @@ -61,23 +59,18 @@ impl DataLinkReceiver for NetworkFrames { // this is so the tests pass consistently thread::sleep(time::Duration::from_millis(500)); } - match self.current_index < self.packets.len() { - true => { - let action = self.next_packet(); - match action { - Some(packet) => { - Ok(&packet[..]) - } - None => { - thread::sleep(time::Duration::from_secs(1)); - Ok(&[][..]) - } + if self.current_index < self.packets.len() { + let action = self.next_packet(); + match action { + Some(packet) => Ok(&packet[..]), + None => { + thread::sleep(time::Duration::from_secs(1)); + Ok(&[][..]) } } - false => { - thread::sleep(time::Duration::from_secs(1)); - Ok(&[][..]) - } + } else { + thread::sleep(time::Duration::from_secs(1)); + Ok(&[][..]) } } } |