Fix lint errors

This commit is contained in:
Fabing Li
2025-02-27 03:09:05 +00:00
committed by Tate, Hongliang Tian
parent 82a2c4cdec
commit cbb4b4e631
24 changed files with 72 additions and 72 deletions

View File

@ -146,7 +146,7 @@ impl ConfigManager<VirtioBlockConfig> {
let cap_high = self
.read_once::<u32>(offset_of!(VirtioBlockConfig, capacity) + 4)
.unwrap() as u64;
blk_config.capacity = cap_high << 32 | cap_low;
blk_config.capacity = (cap_high << 32) | cap_low;
blk_config.size_max = self
.read_once::<u32>(offset_of!(VirtioBlockConfig, size_max))
.unwrap();
@ -193,7 +193,7 @@ impl ConfigManager<VirtioBlockConfig> {
.read_once::<u32>(offset_of!(VirtioBlockConfig, capacity) + 4)
.unwrap() as usize;
cap_high << 32 | cap_low
(cap_high << 32) | cap_low
}
}

View File

@ -264,7 +264,7 @@ impl EventTable {
let segment = FrameAllocOptions::new().alloc_segment(1).unwrap();
let default_event = VirtioInputEvent::default();
let iter = iter::repeat(&default_event).take(EVENT_SIZE);
let iter = iter::repeat_n(&default_event, EVENT_SIZE);
let nr_written = segment.write_vals(0, iter, 0).unwrap();
assert_eq!(nr_written, EVENT_SIZE);

View File

@ -53,10 +53,10 @@ impl SocketDevice {
let guest_cid = field_ptr!(&virtio_vsock_config, VirtioVsockConfig, guest_cid_low)
.read_once()
.unwrap() as u64
| (field_ptr!(&virtio_vsock_config, VirtioVsockConfig, guest_cid_high)
| ((field_ptr!(&virtio_vsock_config, VirtioVsockConfig, guest_cid_high)
.read_once()
.unwrap() as u64)
<< 32;
<< 32);
let mut recv_queue = VirtQueue::new(QUEUE_RECV, QUEUE_SIZE, transport.as_mut())
.expect("creating recv queue fails");

View File

@ -225,7 +225,7 @@ impl VirtioTransport for VirtioMmioTransport {
let device_feature_high = field_ptr!(&self.layout, VirtioMmioLayout, device_features)
.read_once()
.unwrap() as u64;
device_feature_high << 32 | device_feature_low as u64
(device_feature_high << 32) | device_feature_low as u64
}
fn write_driver_features(&mut self, features: u64) -> Result<(), VirtioTransportError> {

View File

@ -163,7 +163,7 @@ impl VirtioTransport for VirtioPciModernTransport {
let device_feature_high = field_ptr!(&self.common_cfg, VirtioPciCommonCfg, device_features)
.read_once()
.unwrap() as u64;
device_feature_high << 32 | device_feature_low as u64
(device_feature_high << 32) | device_feature_low as u64
}
fn write_driver_features(&mut self, features: u64) -> Result<(), VirtioTransportError> {