From c597406838f4a66453e751a490be9b7e317d1c4e Mon Sep 17 00:00:00 2001 From: Transaction Science Date: Wed, 14 Oct 2026 01:19:55 -0400 Subject: [PATCH] IOReport meters: the two clippy warnings each macOS reader carried proof-cascade, eoc-meter and jouleclaw-energy share an IOReport reader, and clippy warned twice in each, only on macOS (the code is gated there): - duplicated_attributes on the empty extern block that links IOReport, IOKit and CoreFoundation. The lint reads the repeated `kind` key across separate `#[link]`s as a duplicate. The links are three distinct libraries, so it is allowed with that reason, as jcp-energy already does. - manual_c_str_literals: `b"IOReportChannels\0"` is now `c"IOReportChannels"`, as the other keys in these files already are. A macOS sweep of every workspace (`cargo clippy --all-targets --keep-going`) found no deny-level error anywhere; these six were the only instances of either lint. Meter tests pass on the build host: proof-cascade 111, eoc-meter 86, jouleclaw-energy (ioreport) 129. Co-Authored-By: Claude Opus 5.5 --- eoc/eoc-rs/crates/eoc-meter/src/lib.rs | 5 ++++- .../crates/jouleclaw-energy/src/apple_ioreport.rs | 6 ++++-- proof/proof-rs/crates/proof-cascade/src/meter.rs | 5 ++++- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/eoc/eoc-rs/crates/eoc-meter/src/lib.rs b/eoc/eoc-rs/crates/eoc-meter/src/lib.rs index fa24bebeb..9b7b4fddd 100644 --- a/eoc/eoc-rs/crates/eoc-meter/src/lib.rs +++ b/eoc/eoc-rs/crates/eoc-meter/src/lib.rs @@ -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() { diff --git a/jouleclaw/jouleclaw-rs/crates/jouleclaw-energy/src/apple_ioreport.rs b/jouleclaw/jouleclaw-rs/crates/jouleclaw-energy/src/apple_ioreport.rs index a80744e7c..ec54c7653 100644 --- a/jouleclaw/jouleclaw-rs/crates/jouleclaw-energy/src/apple_ioreport.rs +++ b/jouleclaw/jouleclaw-rs/crates/jouleclaw-energy/src/apple_ioreport.rs @@ -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() { diff --git a/proof/proof-rs/crates/proof-cascade/src/meter.rs b/proof/proof-rs/crates/proof-cascade/src/meter.rs index 25f61049c..a3052fc20 100644 --- a/proof/proof-rs/crates/proof-cascade/src/meter.rs +++ b/proof/proof-rs/crates/proof-cascade/src/meter.rs @@ -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() { -- 2.54.0 (Apple Git-157)