Skip to content

Commit bfae2dc

Browse files
committed
style: clippy and formatting fixes
Signed-off-by: Philipp Schuster <[email protected]> On-behalf-of: SAP [email protected]
1 parent f6c5b03 commit bfae2dc

File tree

7 files changed

+60
-60
lines changed

7 files changed

+60
-60
lines changed

kvm-bindings/src/arm64/bindings.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ impl<T> __IncompleteArrayField<T> {
2222
}
2323
#[inline]
2424
pub unsafe fn as_slice(&self, len: usize) -> &[T] {
25-
::std::slice::from_raw_parts(self.as_ptr(), len)
25+
unsafe { ::std::slice::from_raw_parts(self.as_ptr(), len) }
2626
}
2727
#[inline]
2828
pub unsafe fn as_mut_slice(&mut self, len: usize) -> &mut [T] {
29-
::std::slice::from_raw_parts_mut(self.as_mut_ptr(), len)
29+
unsafe { ::std::slice::from_raw_parts_mut(self.as_mut_ptr(), len) }
3030
}
3131
}
3232
impl<T> ::std::fmt::Debug for __IncompleteArrayField<T> {

kvm-bindings/src/riscv64/bindings.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ impl<T> __IncompleteArrayField<T> {
2222
}
2323
#[inline]
2424
pub unsafe fn as_slice(&self, len: usize) -> &[T] {
25-
::std::slice::from_raw_parts(self.as_ptr(), len)
25+
unsafe { ::std::slice::from_raw_parts(self.as_ptr(), len) }
2626
}
2727
#[inline]
2828
pub unsafe fn as_mut_slice(&mut self, len: usize) -> &mut [T] {
29-
::std::slice::from_raw_parts_mut(self.as_mut_ptr(), len)
29+
unsafe { ::std::slice::from_raw_parts_mut(self.as_mut_ptr(), len) }
3030
}
3131
}
3232
impl<T> ::std::fmt::Debug for __IncompleteArrayField<T> {

kvm-bindings/src/x86_64/bindings.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,11 @@ impl<T> __IncompleteArrayField<T> {
106106
}
107107
#[inline]
108108
pub unsafe fn as_slice(&self, len: usize) -> &[T] {
109-
::std::slice::from_raw_parts(self.as_ptr(), len)
109+
unsafe { ::std::slice::from_raw_parts(self.as_ptr(), len) }
110110
}
111111
#[inline]
112112
pub unsafe fn as_mut_slice(&mut self, len: usize) -> &mut [T] {
113-
::std::slice::from_raw_parts_mut(self.as_mut_ptr(), len)
113+
unsafe { ::std::slice::from_raw_parts_mut(self.as_mut_ptr(), len) }
114114
}
115115
}
116116
impl<T> ::std::fmt::Debug for __IncompleteArrayField<T> {
@@ -127,11 +127,11 @@ impl<T> __BindgenUnionField<T> {
127127
}
128128
#[inline]
129129
pub unsafe fn as_ref(&self) -> &T {
130-
::std::mem::transmute(self)
130+
unsafe { ::std::mem::transmute(self) }
131131
}
132132
#[inline]
133133
pub unsafe fn as_mut(&mut self) -> &mut T {
134-
::std::mem::transmute(self)
134+
unsafe { ::std::mem::transmute(self) }
135135
}
136136
}
137137
impl<T> ::std::default::Default for __BindgenUnionField<T> {

kvm-ioctls/src/ioctls/device.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -101,18 +101,18 @@ impl DeviceFd {
101101
/// # Arguments
102102
///
103103
/// * `device_attr` - The device attribute to be get.
104-
/// Note: This argument serves as both input and output.
105-
/// When calling this function, the user should explicitly provide
106-
/// valid values for the `group` and the `attr` field of the
107-
/// `kvm_device_attr` structure, and a valid userspace address
108-
/// (i.e. the `addr` field) to access the returned device attribute
109-
/// data.
104+
/// Note: This argument serves as both input and output.
105+
/// When calling this function, the user should explicitly provide
106+
/// valid values for the `group` and the `attr` field of the
107+
/// `kvm_device_attr` structure, and a valid userspace address
108+
/// (i.e. the `addr` field) to access the returned device attribute
109+
/// data.
110110
///
111111
/// # Returns
112112
///
113113
/// * Returns the last occured `errno` wrapped in an `Err`.
114114
/// * `device_attr` - The `addr` field of the `device_attr` structure will point to
115-
/// the device attribute data.
115+
/// the device attribute data.
116116
///
117117
/// # Safety
118118
///

kvm-ioctls/src/ioctls/system.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ impl Kvm {
370370
/// # Arguments
371371
///
372372
/// * `num_entries` - Maximum number of CPUID entries. This function can return less than
373-
/// this when the hardware does not support so many CPUID entries.
373+
/// this when the hardware does not support so many CPUID entries.
374374
///
375375
/// Returns Error `errno::Error(libc::ENOMEM)` when the input `num_entries` is greater than
376376
/// `KVM_MAX_CPUID_ENTRIES`.
@@ -399,7 +399,7 @@ impl Kvm {
399399
/// # Arguments
400400
///
401401
/// * `num_entries` - Maximum number of CPUID entries. This function can return less than
402-
/// this when the hardware does not support so many CPUID entries.
402+
/// this when the hardware does not support so many CPUID entries.
403403
///
404404
/// Returns Error `errno::Error(libc::ENOMEM)` when the input `num_entries` is greater than
405405
/// `KVM_MAX_CPUID_ENTRIES`.
@@ -500,7 +500,7 @@ impl Kvm {
500500
/// # Arguments
501501
///
502502
/// * `msrs` - MSRs (input/output). For details check the `kvm_msrs` structure in the
503-
/// [KVM API doc](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt).
503+
/// [KVM API doc](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt).
504504
///
505505
/// # Example
506506
///
@@ -589,10 +589,10 @@ impl Kvm {
589589
/// # Arguments
590590
///
591591
/// * `ipa_size` - Guest VM IPA size, 32 <= ipa_size <= Host_IPA_Limit.
592-
/// The value of `Host_IPA_Limit` may be different between hardware
593-
/// implementations and can be extracted by calling `get_host_ipa_limit`.
594-
/// Possible values can be found in documentation of registers `TCR_EL2`
595-
/// and `VTCR_EL2`.
592+
/// The value of `Host_IPA_Limit` may be different between hardware
593+
/// implementations and can be extracted by calling `get_host_ipa_limit`.
594+
/// Possible values can be found in documentation of registers `TCR_EL2`
595+
/// and `VTCR_EL2`.
596596
///
597597
/// # Example
598598
///
@@ -619,7 +619,7 @@ impl Kvm {
619619
/// `KVM_GET_VCPU_MMAP_SIZE` ioctl.
620620
///
621621
/// * `vm_type` - Platform and architecture specific platform VM type. A value of 0 is the equivalent
622-
/// to using the default VM type.
622+
/// to using the default VM type.
623623
/// # Example
624624
///
625625
/// ```

kvm-ioctls/src/ioctls/vcpu.rs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ impl VcpuFd {
330330
/// # Arguments
331331
///
332332
/// * `regs` - general purpose registers. For details check the `kvm_regs` structure in the
333-
/// [KVM API doc](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt).
333+
/// [KVM API doc](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt).
334334
///
335335
/// # Example
336336
///
@@ -391,7 +391,7 @@ impl VcpuFd {
391391
/// # Arguments
392392
///
393393
/// * `sregs` - Special registers. For details check the `kvm_sregs` structure in the
394-
/// [KVM API doc](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt).
394+
/// [KVM API doc](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt).
395395
///
396396
/// # Example
397397
///
@@ -451,7 +451,7 @@ impl VcpuFd {
451451
/// # Arguments
452452
///
453453
/// * `fpu` - FPU configuration. For details check the `kvm_fpu` structure in the
454-
/// [KVM API doc](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt).
454+
/// [KVM API doc](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt).
455455
///
456456
/// # Example
457457
///
@@ -570,8 +570,8 @@ impl VcpuFd {
570570
/// # Arguments
571571
///
572572
/// * kvm_enable_cap - KVM capability structure. For details check the `kvm_enable_cap`
573-
/// structure in the
574-
/// [KVM API doc](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt).
573+
/// structure in the
574+
/// [KVM API doc](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt).
575575
///
576576
/// # Example
577577
///
@@ -646,7 +646,7 @@ impl VcpuFd {
646646
/// # Arguments
647647
///
648648
/// * `klapic` - LAPIC state. For details check the `kvm_lapic_state` structure in the
649-
/// [KVM API doc](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt).
649+
/// [KVM API doc](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt).
650650
/// # Example
651651
///
652652
/// ```rust
@@ -690,7 +690,7 @@ impl VcpuFd {
690690
/// # Arguments
691691
///
692692
/// * `msrs` - MSRs (input/output). For details check the `kvm_msrs` structure in the
693-
/// [KVM API doc](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt).
693+
/// [KVM API doc](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt).
694694
///
695695
/// # Example
696696
///
@@ -735,7 +735,7 @@ impl VcpuFd {
735735
/// # Arguments
736736
///
737737
/// * `msrs` - MSRs. For details check the `kvm_msrs` structure in the
738-
/// [KVM API doc](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt).
738+
/// [KVM API doc](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt).
739739
/// # Example
740740
///
741741
/// ```rust
@@ -876,7 +876,7 @@ impl VcpuFd {
876876
/// # Arguments
877877
///
878878
/// * `xsave` - A mutable reference to an [`Xsave`] instance that will be populated with the
879-
/// current vcpu's "xsave struct".
879+
/// current vcpu's "xsave struct".
880880
///
881881
/// # Safety
882882
///
@@ -1224,8 +1224,8 @@ impl VcpuFd {
12241224
/// # Arguments
12251225
///
12261226
/// * `kvi` - information about preferred CPU target type and recommended features for it.
1227-
/// For details check the `kvm_vcpu_init` structure in the
1228-
/// [KVM API doc](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt).
1227+
/// For details check the `kvm_vcpu_init` structure in the
1228+
/// [KVM API doc](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt).
12291229
///
12301230
/// # Example
12311231
/// ```rust
@@ -1314,8 +1314,8 @@ impl VcpuFd {
13141314
/// # Arguments
13151315
///
13161316
/// * `reg_list` - list of registers (input/output). For details check the `kvm_reg_list`
1317-
/// structure in the
1318-
/// [KVM API doc](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt).
1317+
/// structure in the
1318+
/// [KVM API doc](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt).
13191319
///
13201320
/// # Example
13211321
///
@@ -1358,8 +1358,8 @@ impl VcpuFd {
13581358
/// # Arguments
13591359
///
13601360
/// * `debug_struct` - control bitfields and debug registers, depending on the specific architecture.
1361-
/// For details check the `kvm_guest_debug` structure in the
1362-
/// [KVM API doc](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt).
1361+
/// For details check the `kvm_guest_debug` structure in the
1362+
/// [KVM API doc](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt).
13631363
///
13641364
/// # Example
13651365
///

kvm-ioctls/src/ioctls/vm.rs

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ impl VmFd {
6969
/// # Arguments
7070
///
7171
/// * `user_memory_region` - Guest physical memory slot. For details check the
72-
/// `kvm_userspace_memory_region` structure in the
73-
/// [KVM API doc](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt).
72+
/// `kvm_userspace_memory_region` structure in the
73+
/// [KVM API doc](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt).
7474
///
7575
/// # Safety
7676
///
@@ -123,8 +123,8 @@ impl VmFd {
123123
/// # Arguments
124124
///
125125
/// * `user_memory_region2` - Guest physical memory slot. For details check the
126-
/// `kvm_userspace_memory_region2` structure in the
127-
/// [KVM API doc](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt).
126+
/// `kvm_userspace_memory_region2` structure in the
127+
/// [KVM API doc](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt).
128128
///
129129
/// # Safety
130130
///
@@ -376,7 +376,7 @@ impl VmFd {
376376
/// # Arguments
377377
///
378378
/// * pit_config - PIT configuration. For details check the `kvm_pit_config` structure in the
379-
/// [KVM API doc](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt).
379+
/// [KVM API doc](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt).
380380
/// # Example
381381
///
382382
/// ```rust
@@ -548,7 +548,7 @@ impl VmFd {
548548
/// # Arguments
549549
///
550550
/// * kvm_msi - MSI message configuration. For details check the `kvm_msi` structure in the
551-
/// [KVM API doc](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt).
551+
/// [KVM API doc](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt).
552552
/// # Example
553553
///
554554
/// In this example, the important function signal_msi() calling into
@@ -598,10 +598,10 @@ impl VmFd {
598598
/// # Arguments
599599
///
600600
/// * kvm_irq_routing - IRQ routing configuration. Describe all routes
601-
/// associated with GSI entries. For details check
602-
/// the `kvm_irq_routing` and `kvm_irq_routing_entry`
603-
/// structures in the
604-
/// [KVM API doc](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt).
601+
/// associated with GSI entries. For details check
602+
/// the `kvm_irq_routing` and `kvm_irq_routing_entry`
603+
/// structures in the
604+
/// [KVM API doc](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt).
605605
/// # Example
606606
///
607607
/// ```rust
@@ -651,11 +651,11 @@ impl VmFd {
651651
/// # Arguments
652652
///
653653
/// * `fd` - `EventFd` which will be signaled. When signaling, the usual `vmexit` to userspace
654-
/// is prevented.
654+
/// is prevented.
655655
/// * `addr` - Address being written to.
656656
/// * `datamatch` - Limits signaling `fd` to only the cases where the value being written is
657-
/// equal to this parameter. The size of `datamatch` is important and it must
658-
/// match the expected size of the guest's write.
657+
/// equal to this parameter. The size of `datamatch` is important and it must
658+
/// match the expected size of the guest's write.
659659
///
660660
/// # Example
661661
///
@@ -1257,7 +1257,7 @@ impl VmFd {
12571257
/// # Arguments
12581258
///
12591259
/// * `device`: device configuration. For details check the `kvm_create_device` structure in the
1260-
/// [KVM API doc](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt).
1260+
/// [KVM API doc](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt).
12611261
///
12621262
/// # Example
12631263
///
@@ -1320,8 +1320,8 @@ impl VmFd {
13201320
///
13211321
/// # Arguments
13221322
/// * `kvi` - CPU target configuration (out). For details check the `kvm_vcpu_init`
1323-
/// structure in the
1324-
/// [KVM API doc](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt).
1323+
/// structure in the
1324+
/// [KVM API doc](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt).
13251325
///
13261326
/// # Example
13271327
///
@@ -1355,8 +1355,8 @@ impl VmFd {
13551355
/// # Arguments
13561356
///
13571357
/// * kvm_enable_cap - KVM capability structure. For details check the `kvm_enable_cap`
1358-
/// structure in the
1359-
/// [KVM API doc](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt).
1358+
/// structure in the
1359+
/// [KVM API doc](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt).
13601360
///
13611361
/// # Example
13621362
///
@@ -1484,8 +1484,8 @@ impl VmFd {
14841484
/// # Arguments
14851485
///
14861486
/// * kvm_create_guest_memfd - KVM create guest memfd structure. For details check the
1487-
/// `kvm_create_guest_memfd` structure in the
1488-
/// [KVM API doc](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt).
1487+
/// `kvm_create_guest_memfd` structure in the
1488+
/// [KVM API doc](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt).
14891489
///
14901490
/// # Example
14911491
///
@@ -1536,8 +1536,8 @@ impl VmFd {
15361536
/// # Arguments
15371537
///
15381538
/// * kvm_memory_attributes - KVM set memory attributes structure. For details check the
1539-
/// `kvm_memory_attributes` structure in the
1540-
/// [KVM API doc](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt).
1539+
/// `kvm_memory_attributes` structure in the
1540+
/// [KVM API doc](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt).
15411541
///
15421542
/// # Example
15431543
///

0 commit comments

Comments
 (0)