From 39f5814d4ac348b035b3f22b7ef2f568b1507abb Mon Sep 17 00:00:00 2001 From: selikhov Date: Sat, 3 Oct 2026 12:24:56 +0300 Subject: [PATCH] Let the Android clippy run pass: two thread_locals it misreads `cargo ndk ... clippy -p voelin-android -p voelin-ui -- -D warnings` stopped at missing_const_for_thread_local on the window's app state and the audio input buffer, which are both `const` already: on Android targets the macro expands so that clippy does not see the initializer. Allowed locally, with that reason. Co-Authored-By: Claude Opus 5.5 --- crates/voelin-android/src/bridge.rs | 4 +++- crates/voelin-ui/src/app.rs | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/crates/voelin-android/src/bridge.rs b/crates/voelin-android/src/bridge.rs index f7d442d..9bee6f3 100644 --- a/crates/voelin-android/src/bridge.rs +++ b/crates/voelin-android/src/bridge.rs @@ -331,7 +331,9 @@ fn on_audio_input<'local>( channels: jint, ) -> Result { thread_local! { - // One per capture thread, reused for every call. + // One per capture thread, reused for every call. (It is `const`; + // clippy for Android does not see that through the expansion.) + #[allow(clippy::missing_const_for_thread_local)] static BUFFER: std::cell::RefCell> = const { std::cell::RefCell::new(Vec::new()) }; } let id = id as u64; diff --git a/crates/voelin-ui/src/app.rs b/crates/voelin-ui/src/app.rs index fc42ae1..07a07a6 100644 --- a/crates/voelin-ui/src/app.rs +++ b/crates/voelin-ui/src/app.rs @@ -395,6 +395,9 @@ pub(crate) struct App { } thread_local! { + // It is `const`; clippy for Android targets does not see that through + // the macro's expansion there. + #[allow(clippy::missing_const_for_thread_local)] static APP: RefCell> = const { RefCell::new(None) }; }