Fix clippy errors

New clippy errors were reported with an updated rust-vmm-ci submodule,
fix them.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
This commit is contained in:
Viresh Kumar 2023-01-16 10:24:26 +05:30 committed by Viresh Kumar
parent a8d33df1ae
commit 26a0f3ad4d
6 changed files with 8 additions and 8 deletions

View File

@ -110,7 +110,7 @@ impl TryFrom<GpioArgs> for GpioConfiguration {
let devices = DeviceConfig::try_from(args.device_list.as_str())?;
if devices.inner.len() != args.socket_count as usize {
if devices.inner.len() != args.socket_count {
return Err(Error::DeviceCountMismatch(
args.socket_count,
devices.inner.len(),

View File

@ -257,7 +257,7 @@ impl GpioDevice for PhysDevice {
fn set_irq_type(&self, gpio: u16, value: u16) -> Result<()> {
let state = &mut self.state[gpio as usize].write().unwrap();
let edge = match value as u16 {
let edge = match value {
VIRTIO_GPIO_IRQ_TYPE_EDGE_RISING => line::Edge::Rising,
VIRTIO_GPIO_IRQ_TYPE_EDGE_FALLING => line::Edge::Falling,
VIRTIO_GPIO_IRQ_TYPE_EDGE_BOTH => line::Edge::Both,
@ -609,7 +609,7 @@ pub(crate) mod tests {
}
self.state.write().unwrap()[gpio as usize].dir = dir;
self.state.write().unwrap()[gpio as usize].val = match dir as u8 {
self.state.write().unwrap()[gpio as usize].val = match dir {
VIRTIO_GPIO_DIRECTION_NONE => None,
VIRTIO_GPIO_DIRECTION_IN => self.state.read().unwrap()[gpio as usize].val,
VIRTIO_GPIO_DIRECTION_OUT => Some(value as u16),

View File

@ -593,7 +593,7 @@ impl<D: I2cDevice> I2cMap<D> {
};
// get the corresponding adapter based on the device config.
let adapter = &self.adapters[index as usize];
let adapter = &self.adapters[index];
// Set device's address
adapter.set_device_addr(device as usize)?;
@ -795,7 +795,7 @@ pub(crate) mod tests {
}
}
i2c_map.transfer(&mut *reqs).unwrap();
i2c_map.transfer(&mut reqs).unwrap();
verify_rdwr_data(&reqs);
}

View File

@ -502,7 +502,7 @@ mod tests {
_ => 0x100,
};
let desc = Descriptor::new(offset, len[i], f as u16, (i + 1) as u16);
let desc = Descriptor::new(offset, len[i], f, (i + 1) as u16);
vq.desc_table().store(i as u16, desc).unwrap();
}

View File

@ -176,7 +176,7 @@ mod tests {
fn verify_cmd_line_arguments() {
// All parameters have default values, except for the socket path. White spaces are
// introduced on purpose to make sure Strings are trimmed properly.
let default_args: RngArgs = Parser::parse_from(&["", "-s /some/socket_path "]);
let default_args: RngArgs = Parser::parse_from(["", "-s /some/socket_path "]);
// A valid configuration that should be equal to the above default configuration.
let args = RngArgs {

View File

@ -169,7 +169,7 @@ impl<T: Read> VuRngBackend<T> {
let len = desc_chain
.memory()
.read_from(descriptor.addr(), &mut *rng_source, to_read as usize)
.read_from(descriptor.addr(), &mut *rng_source, to_read)
.map_err(|_| VuRngError::UnexpectedRngSourceError)?;
timer.quota_remaining -= len;