From 35db6f545a763ad4d66e4ebbf53cad1bdb2eaa62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Kr=C3=B6ning?= Date: Wed, 9 Sep 2026 15:46:17 +0200 Subject: [PATCH] fix(aml): Fix clippy::unnecessary_cast ```console $ cargo clippy warning: casting to the same type is unnecessary (`usize` -> `usize`) --> src/aml/resource.rs:767:21 | 767 | let pin_count = ((source_name_offset - pin_table_offset) / 2) as usize; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `((source_name_offset - pin_table_offset) / 2)` | = help: for further information visit https://rust-lang.github.io/rust-clippy/main/index.html#unnecessary_cast = note: `#[warn(clippy::unnecessary_cast)]` on by default warning: `acpi` (lib) generated 1 warning (run `cargo clippy --fix --lib -p acpi -- ` to apply 1 suggestion) ``` --- src/aml/resource.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/aml/resource.rs b/src/aml/resource.rs index 28807c32..81c5e3c0 100644 --- a/src/aml/resource.rs +++ b/src/aml/resource.rs @@ -764,7 +764,7 @@ fn gpio_connection_descriptor(bytes: &[u8]) -> Result { let vendor_data_offset = LittleEndian::read_u16(&bytes[19..=20]) as usize; let vendor_data_length = LittleEndian::read_u16(&bytes[21..=22]) as usize; - let pin_count = ((source_name_offset - pin_table_offset) / 2) as usize; + let pin_count = (source_name_offset - pin_table_offset) / 2; let vendor_data = &bytes[vendor_data_offset..vendor_data_offset + vendor_data_length]; let source = str::from_utf8(&bytes[source_name_offset..bytes.len() - vendor_data_length - 1]) .map_err(|_| AmlError::InvalidResourceDescriptor)?;