File tree Expand file tree Collapse file tree 3 files changed +8
-10
lines changed Expand file tree Collapse file tree 3 files changed +8
-10
lines changed Original file line number Diff line number Diff line change @@ -96,7 +96,7 @@ impl Kvm {
96
96
/// ```
97
97
pub fn open_with_cloexec ( close_on_exec : bool ) -> Result < RawFd > {
98
98
// SAFETY: Safe because we give a constant nul-terminated string.
99
- let kvm_path = unsafe { CStr :: from_bytes_with_nul_unchecked ( b "/dev/kvm\0 " ) } ;
99
+ let kvm_path = c "/dev/kvm" ;
100
100
Self :: open_with_cloexec_at ( kvm_path, close_on_exec)
101
101
}
102
102
@@ -741,7 +741,7 @@ mod tests {
741
741
742
742
#[ test]
743
743
fn test_kvm_new_with_path ( ) {
744
- let kvm_path = unsafe { CStr :: from_bytes_with_nul_unchecked ( b "/dev/kvm\0 " ) } ;
744
+ let kvm_path = c "/dev/kvm" ;
745
745
Kvm :: new_with_path ( kvm_path) . unwrap ( ) ;
746
746
}
747
747
@@ -981,6 +981,6 @@ mod tests {
981
981
982
982
// Don't drop the File object, or it'll notice the file it's trying to close is
983
983
// invalid and abort the process.
984
- faulty_kvm. kvm . into_raw_fd ( ) ;
984
+ let _ = faulty_kvm. kvm . into_raw_fd ( ) ;
985
985
}
986
986
}
Original file line number Diff line number Diff line change @@ -1088,7 +1088,6 @@ impl VcpuFd {
1088
1088
target_arch = "arm" ,
1089
1089
target_arch = "aarch64"
1090
1090
) ) ]
1091
-
1092
1091
pub fn set_vcpu_events ( & self , vcpu_events : & kvm_vcpu_events ) -> Result < ( ) > {
1093
1092
// SAFETY: Here we trust the kernel not to read past the end of the kvm_vcpu_events struct.
1094
1093
let ret = unsafe { ioctl_with_ref ( self , KVM_SET_VCPU_EVENTS ( ) , vcpu_events) } ;
@@ -1639,7 +1638,7 @@ impl VcpuFd {
1639
1638
/// # Arguments
1640
1639
///
1641
1640
/// * `freq` - The frequency unit is KHz as per the KVM API documentation
1642
- /// for `KVM_SET_TSC_KHZ`.
1641
+ /// for `KVM_SET_TSC_KHZ`.
1643
1642
///
1644
1643
/// # Example
1645
1644
///
@@ -2575,7 +2574,7 @@ mod tests {
2575
2574
2576
2575
// Don't drop the File object, or it'll notice the file it's trying to close is
2577
2576
// invalid and abort the process.
2578
- faulty_vcpu_fd. vcpu . into_raw_fd ( ) ;
2577
+ let _ = faulty_vcpu_fd. vcpu . into_raw_fd ( ) ;
2579
2578
}
2580
2579
2581
2580
#[ test]
@@ -2699,7 +2698,7 @@ mod tests {
2699
2698
2700
2699
// Don't drop the File object, or it'll notice the file it's trying to close is
2701
2700
// invalid and abort the process.
2702
- faulty_vcpu_fd. vcpu . into_raw_fd ( ) ;
2701
+ let _ = faulty_vcpu_fd. vcpu . into_raw_fd ( ) ;
2703
2702
}
2704
2703
2705
2704
#[ test]
Original file line number Diff line number Diff line change @@ -913,8 +913,7 @@ impl VmFd {
913
913
// For ease of access we are saving the bitmap in a u64 vector. We are using ceil to
914
914
// make sure we count all dirty pages even when `memory_size` is not a multiple of
915
915
// `page_size * 64`.
916
- let div_ceil = |dividend, divisor| ( dividend + divisor - 1 ) / divisor;
917
- let bitmap_size = div_ceil ( memory_size, page_size * 64 ) ;
916
+ let bitmap_size = memory_size. div_ceil ( page_size * 64 ) ;
918
917
let mut bitmap = vec ! [ 0u64 ; bitmap_size] ;
919
918
let dirtylog = kvm_dirty_log {
920
919
slot,
@@ -2406,7 +2405,7 @@ mod tests {
2406
2405
2407
2406
// Don't drop the File object, or it'll notice the file it's trying to close is
2408
2407
// invalid and abort the process.
2409
- faulty_vm_fd. vm . into_raw_fd ( ) ;
2408
+ let _ = faulty_vm_fd. vm . into_raw_fd ( ) ;
2410
2409
}
2411
2410
2412
2411
#[ test]
You can’t perform that action at this time.
0 commit comments