Skip to content

Commit

Permalink
kvm: fix clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Wenzel committed Feb 20, 2024
1 parent a65c081 commit 079bb34
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/driver/kvm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ impl<T: KVMIntrospectable> Kvm<T> {

// set vec_events size
let vcpu_count = kvm.get_vcpu_count()?;
kvm.vec_events.resize_with(vcpu_count.try_into()?, || None);
kvm.vec_events.resize_with(vcpu_count.into(), || None);

// enable CR event intercept by default
// (interception will take place when CR register will be specified)
Expand Down Expand Up @@ -323,7 +323,7 @@ impl<T: KVMIntrospectable> Introspectable for Kvm<T> {
};

let vcpu = kvmi_event.vcpu;
let vcpu_index: usize = vcpu.try_into()?;
let vcpu_index: usize = vcpu.into();
self.vec_events[vcpu_index] = Some(kvmi_event);

Ok(Some(Event {
Expand All @@ -343,8 +343,8 @@ impl<T: KVMIntrospectable> Introspectable for Kvm<T> {
EventReplyType::Continue => KVMiEventReply::Continue,
};
// get KVMiEvent associated with this VCPU
let vcpu_index: usize = event.vcpu.try_into()?;
let kvmi_event = mem::replace(&mut self.vec_events[vcpu_index], None).unwrap();
let vcpu_index: usize = event.vcpu.into();
let kvmi_event = &mut self.vec_events[vcpu_index].take();
Ok(self.kvmi.reply(&kvmi_event, kvm_reply_type)?)

Check failure on line 348 in src/driver/kvm.rs

View workflow job for this annotation

GitHub Actions / kvm

mismatched types
}

Expand Down

0 comments on commit 079bb34

Please sign in to comment.