kvm/tests: fix clippy::never_loop

This loop always ran exactly once, so it doesn't need to be a loop.

BUG=b:344974550
TEST=tools/clippy

Change-Id: I6fe2620d4ba712b573515122720caeafc44081cf
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5609075
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
This commit is contained in:
Daniel Verkamp 2024-04-08 12:58:48 -07:00 committed by crosvm LUCI
parent cf5d251863
commit 50dd3cae44

View file

@ -62,11 +62,9 @@ fn test_run() {
.expect("failed to register memory"); .expect("failed to register memory");
let runnable_vcpu = vcpu.to_runnable(None).unwrap(); let runnable_vcpu = vcpu.to_runnable(None).unwrap();
loop { let run_result = runnable_vcpu.run().expect("run failed");
match runnable_vcpu.run().expect("run failed") { if !matches!(run_result, VcpuExit::Hlt) {
VcpuExit::Hlt => break, panic!("unexpected exit reason: {:?}", run_result);
r => panic!("unexpected exit reason: {:?}", r),
}
} }
let mut dirty_log = [0x0, 0x0]; let mut dirty_log = [0x0, 0x0];