Skip to content

fix(aml): Fix clippy::unnecessary_cast - #350

Merged
martin-hughes merged 1 commit into
rust-osdev:mainfrom
mkroening:clippy-unnecessary_cast
Sep 9, 2026
Merged

fix(aml): Fix clippy::unnecessary_cast#350
martin-hughes merged 1 commit into
rust-osdev:mainfrom
mkroening:clippy-unnecessary_cast

Conversation

@mkroening

Copy link
Copy Markdown
Member
$ 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)

While looking for missed warnings in #338, I noticed a new one introduced in c526710. I think this is a good example in favor of #347. :)

```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)
```
@martin-hughes

Copy link
Copy Markdown
Contributor

Easy tidy up, thanks 😊

@martin-hughes
martin-hughes merged commit 09d5c67 into rust-osdev:main Sep 9, 2026
6 checks passed
@mkroening
mkroening deleted the clippy-unnecessary_cast branch September 9, 2026 14:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants