IOReport meters: the two clippy warnings each macOS reader carried #244

Merged
dcharlot merged 1 commit from fix/ioreport-meter-lints into main 2026-10-14 09:09:23 -04:00
3 changed files with 12 additions and 4 deletions

View file

@ -1617,6 +1617,9 @@ mod macos_ioreport {
) -> bool;
}
// Three distinct frameworks, each legitimately `kind = "framework"`; the
// lint mis-reads the repeated key across separate `#[link]`s as a duplicate.
#[allow(clippy::duplicated_attributes)]
#[link(name = "IOReport", kind = "dylib")]
#[link(name = "IOKit", kind = "framework")]
#[link(name = "CoreFoundation", kind = "framework")]
@ -2010,7 +2013,7 @@ mod macos_ioreport {
unsafe {
let key = CFStringCreateWithCString(
std::ptr::null_mut(),
b"IOReportChannels\0".as_ptr() as *const _,
c"IOReportChannels".as_ptr() as *const _,
K_CFSTRING_ENCODING_UTF8,
);
if key.is_null() {

View file

@ -131,7 +131,9 @@ unsafe extern "C" {
// IOReport's symbols live in the dyld shared cache (no on-disk framework
// bundle since Big Sur), so link it as a dylib; IOKit + CoreFoundation are
// real frameworks.
// real frameworks. Clippy mis-reads the repeated `kind` key across separate
// `#[link]`s as a duplicate attribute.
#[allow(clippy::duplicated_attributes)]
#[link(name = "IOReport", kind = "dylib")]
#[link(name = "IOKit", kind = "framework")]
#[link(name = "CoreFoundation", kind = "framework")]
@ -1037,7 +1039,7 @@ fn sum_energy_uj(delta: CFDictionaryRef) -> u64 {
unsafe {
let key = CFStringCreateWithCString(
std::ptr::null_mut(),
b"IOReportChannels\0".as_ptr() as *const _,
c"IOReportChannels".as_ptr() as *const _,
K_CFSTRING_ENCODING_UTF8,
);
if key.is_null() {

View file

@ -3189,6 +3189,9 @@ mod macos_ioreport {
) -> bool;
}
// Three distinct frameworks, each legitimately `kind = "framework"`; the
// lint mis-reads the repeated key across separate `#[link]`s as a duplicate.
#[allow(clippy::duplicated_attributes)]
#[link(name = "IOReport", kind = "dylib")]
#[link(name = "IOKit", kind = "framework")]
#[link(name = "CoreFoundation", kind = "framework")]
@ -3422,7 +3425,7 @@ mod macos_ioreport {
unsafe fn sum_energy_uj(delta: CFDictionaryRef) -> u64 {
let key = CFStringCreateWithCString(
std::ptr::null_mut(),
b"IOReportChannels\0".as_ptr() as *const _,
c"IOReportChannels".as_ptr() as *const _,
K_CFSTRING_ENCODING_UTF8,
);
if key.is_null() {