diff --git a/vhost-device-i2c/Cargo.toml b/vhost-device-i2c/Cargo.toml index fc2ba96..1151a81 100644 --- a/vhost-device-i2c/Cargo.toml +++ b/vhost-device-i2c/Cargo.toml @@ -31,3 +31,6 @@ vmm-sys-util = "0.14" assert_matches = "1.5" virtio-queue = { version = "0.16", features = ["test-utils"] } vm-memory = { version = "0.16.1", features = ["backend-mmap", "backend-atomic"] } + +[lints] +workspace = true diff --git a/vhost-device-i2c/src/i2c.rs b/vhost-device-i2c/src/i2c.rs index c6064b6..4fd281c 100644 --- a/vhost-device-i2c/src/i2c.rs +++ b/vhost-device-i2c/src/i2c.rs @@ -242,7 +242,8 @@ impl SmbusMsg { // Special Read requests, reqs[0].len can be 0 or 1 only. Err(Error::MessageLengthInvalid("read", 3)) } else { - data.word = reqs[0].buf[1] as u16 | ((reqs[0].buf[2] as u16) << 8); + data.word = + u16::from(reqs[0].buf[1]) | (u16::from(reqs[0].buf[2]) << 8); Ok(SmbusMsg { read_write, command: reqs[0].buf[0], diff --git a/vhost-device-i2c/src/vhu_i2c.rs b/vhost-device-i2c/src/vhu_i2c.rs index fbc754e..c4d7ffd 100644 --- a/vhost-device-i2c/src/vhu_i2c.rs +++ b/vhost-device-i2c/src/vhu_i2c.rs @@ -407,7 +407,7 @@ mod tests { vq.desc_table() .store(index, RawDescriptor::from(desc_out)) .unwrap(); - next_addr += desc_out.len() as u64; + next_addr += u64::from(desc_out.len()); index += 1; // Buf descriptor: optional @@ -430,7 +430,7 @@ mod tests { vq.desc_table() .store(index, RawDescriptor::from(desc_buf)) .unwrap(); - next_addr += desc_buf.len() as u64; + next_addr += u64::from(desc_buf.len()); index += 1; }