Skip to content

Conversation

@mkroening
Copy link
Member

@mkroening mkroening commented Jan 7, 2026

While rust-lang/stdarch#1935 has not reached stable yet, on nightly, Clippy makes the CI fail:

warning: unnecessary `unsafe` block
  --> src/instructions/random.rs:13:21
   |
13 |         let cpuid = unsafe { core::arch::x86_64::__cpuid(0x1) };
   |                     ^^^^^^ unnecessary `unsafe` block
   |
   = note: `#[warn(unused_unsafe)]` (part of `#[warn(unused)]`) on by default

warning: unnecessary `unsafe` block
  --> src/instructions/smap.rs:38:21
   |
38 |         let cpuid = unsafe { core::arch::x86_64::__cpuid(7) };
   |                     ^^^^^^ unnecessary `unsafe` block

warning: unnecessary `unsafe` block
   --> src/instructions/tlb.rs:163:21
    |
163 |         let cpuid = unsafe { core::arch::x86_64::__cpuid(0x8000_0008) };
    |                     ^^^^^^ unnecessary `unsafe` block

warning: unnecessary `unsafe` block
   --> src/instructions/tlb.rs:172:21
    |
172 |         let cpuid = unsafe { core::arch::x86_64::__cpuid(0x8000_000a) };
    |                     ^^^^^^ unnecessary `unsafe` block

Please let me know if you would like to have this conditional or whether I should add a comment. :)

Note that this might not be intentional and may be fixed in the future: rust-lang/stdarch#1990

Copy link
Member

@Freax13 Freax13 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@Freax13 Freax13 merged commit f054b0c into rust-osdev:master Jan 10, 2026
12 checks passed
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