wip: rustfmt, clippy fixes for the Android target

This commit is contained in:
Claude committed 2026-09-26 15:14:04 +00:00
1 parent 6046e6ceb7
commit 7a8c901a08
8 files changed
+46 -17

No files matched your search

+4 -4
View File
@@ -111,10 +111,10 @@ fn watch_voice(host: &'static EngineHost) {
loop {
match events.recv().await {
Ok(event) => {
if let Some(text) = with_foreground(|f| f.update(&event)) {
if let Err(e) = bridge::set_voice_notification(text.as_deref()) {
warn!("voice service: {e}");
}
if let Some(text) = with_foreground(|f| f.update(&event))
&& let Err(e) = bridge::set_voice_notification(text.as_deref())
{
warn!("voice service: {e}");
}
}
Err(tokio::sync::broadcast::error::RecvError::Lagged(_)) => continue,
+7 -2
View File
@@ -39,8 +39,13 @@ pub fn context<'local>(env: &mut Env<'local>) -> Result<JObject<'local>> {
let class = BRIDGE
.get()
.ok_or_else(|| Error::ClassNotFound { name: "io.github.faumaray.tsc.Bridge".into() })?;
env.call_static_method(class, jni_str!("context"), jni_sig!(() -> android.content.Context), &[])?
.l()
env.call_static_method(
class,
jni_str!("context"),
jni_sig!(() -> android.content.Context),
&[],
)?
.l()
}
/// Ask for the microphone and notification permissions if not granted yet.
+7 -1
View File
@@ -159,7 +159,13 @@ pub fn wants_frames() -> bool {
}
/// A captured RGBA frame. Returns `false` once nobody wants frames.
pub fn on_frame(pixels: Vec<u8>, width: u32, height: u32, stride: usize, timestamp_ns: i64) -> bool {
pub fn on_frame(
pixels: Vec<u8>,
width: u32,
height: u32,
stride: usize,
timestamp_ns: i64,
) -> bool {
with_state(|s| {
let timestamp = since(&mut s.first_frame_ns, timestamp_ns);
let Some(frames) = &s.frames else {
+4 -1
View File
@@ -91,7 +91,10 @@ mod tests {
capabilities: Capabilities::default(),
};
assert_eq!(fg.update(&info), Some(Some("Connecting to Home".into())));
assert_eq!(fg.update(&voice(1, VoiceState::Connected)), Some(Some("In voice on Home".into())));
assert_eq!(
fg.update(&voice(1, VoiceState::Connected)),
Some(Some("In voice on Home".into()))
);
assert_eq!(fg.update(&voice(1, VoiceState::Connected)), None, "no change");
assert_eq!(
fg.update(&voice(2, VoiceState::Connecting)),