From e9ea9d63f84593c1ece5e319bbdef532cd84ea16 Mon Sep 17 00:00:00 2001 From: Rob Bradford Date: Tue, 19 Oct 2021 15:01:42 +0100 Subject: [PATCH] vmm: Use assert!() rather than if+panic As identified by the new beta clippy. Signed-off-by: Rob Bradford --- vmm/src/sigwinch_listener.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/vmm/src/sigwinch_listener.rs b/vmm/src/sigwinch_listener.rs index 13fd3464c..a1a4d4ce4 100644 --- a/vmm/src/sigwinch_listener.rs +++ b/vmm/src/sigwinch_listener.rs @@ -94,9 +94,11 @@ fn sigwinch_listener_main(seccomp_filter: BpfProgram, tx: File, tty: &File) -> ! while unsafe { poll(&mut pollfd, 1, -1) } == -1 { let e = io::Error::last_os_error(); - if !matches!(e.kind(), ErrorKind::Interrupted | ErrorKind::WouldBlock) { - panic!("poll: {}", e); - } + assert!( + matches!(e.kind(), ErrorKind::Interrupted | ErrorKind::WouldBlock), + "poll: {}", + e + ); } assert_eq!(pollfd.revents, POLLERR);