acpmux: fix the base compile error from #24739 (images as a slice)

Merged
TE
13d ago
+3-3

Fixes the acpmux base red that #24739 (2584a857) introduced on feat-cmux-next. It hides every acpmux test: Rust MSRV (1.91), clippy, cargo test and the cross-build fail on every acpmux PR (for example #24811, run 40068104184, which changes none of these files).

error[E0308]: mismatched types
   --> crates/acpmux/src/hub/prompt_images.rs:382:67
382 |             msg.get("images").and_then(Value::as_array).unwrap_or(&[]),
    |                                                                   ^^^ expected `&Vec<Value>`, found `&[_; 0]`

The same error is at hub/queue.rs:370 and hub/queue_edit.rs:188.

Change. At all three sites, .and_then(Value::as_array).unwrap_or(&[]) becomes .and_then(Value::as_array).map(Vec::as_slice).unwrap_or_default(). inline_parts takes &[Value], and no images is still an empty slice, so behaviour doesn't change. It's 3 lines. rustfmt (edition 2024) is clean, and CI's Rust jobs on this PR are the compile check.

Risk. Low. It's a type-level fix with no behaviour change.

Agent session: cosmic-gray

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.


Summary by cubic

Fixes the acpmux compile error that #24739 introduced on feat-cmux-next, which was breaking Rust MSRV, clippy, cargo test, and cross-build checks on every acpmux PR. At three sites, .and_then(Value::as_array).unwrap_or(&[]) didn't type-check because unwrap_or expects &Vec<Value> while &[] is a slice literal. The fix maps to a slice first (.map(Vec::as_slice).unwrap_or_default()), matching what inline_parts takes. This is a type-level fix only—no images still means an empty slice, so behavior is unchanged.