The Windows pipe listener's accept takes &mut self
(crates/jcode-transport/src/windows.rs:69) while the unix listener's takes
&self, so the companion server's listener must be mut on Windows only;
bind it with #[allow(unused_mut)] to satisfy both backends (fixes E0596 in
crates/jcode-companion/src/server.rs:209).
In crates/jcode-desktop-open, the serde::Deserialize import is only needed
by structs gated #[cfg(any(test, all(unix, not(target_os = "macos"))))],
so gate the import the same way and stop tripping the macOS warning budget.
Closes 1jehuang#1803
Assisted-by: AI coding agent (GLM); reviewed and tested by akushonkamen
Signed-off-by: akushonkamen <[email protected]>
Fixes #1803
根因
两个独立编译错误/警告:
crates/jcode-companion/src/server.rs:168的listener未声明mut,而 Windows pipe 后端的accept(&mut self)(crates/jcode-transport/src/windows.rs:69)要求&mut;unix 后端accept(&self)下直接加mut又会触发unused_mut。crates/jcode-desktop-open/src/lib.rs:8的serde::Deserialize唯一使用点NiriWindow(:308)/NiriTimestamp(:318) 均被#[cfg(any(test, all(unix, not(target_os="macos"))))]门住,macOS 非 test 构建下该 import 未用,超出仓库 0 warning 预算。修法
server.rs:168改为#[allow(unused_mut)] let mut listener = bind(...),并附注释说明双后端差异(Windows 下mut实际使用,unix 下允许未用)。lib.rs:8的use serde::Deserialize;加同一 cfg 门#[cfg(any(test, all(unix, not(target_os = "macos"))))]。核验
df76cf0c含Closes #1803,按 AGENTS.md 配置身份提交。测试
红(stash 修复杂交实跑):
timeout 600 cargo check -p jcode-desktop-open→warning: unused import serde::Deserialize@ lib.rs:8,1 warning。绿(本机 macOS,全部复跑确认):
timeout 600 cargo check -p jcode-desktop-open→ 0 unused-import warning。timeout 600 cargo check -p jcode-desktop-open -p jcode-companion→Finished。timeout 600 cargo test -p jcode-companion -p jcode-desktop-open→ 15 passed / 6 passed / 0 failed。cargo fmt --check -p jcode-companion -p jcode-desktop-open→ exit 0。(全仓 fmt 仍红,系 master 既有 master is red: Check formatting fails on two files from 567706b70, hiding an oversized-file ratchet failure behind it #1796,与本次改动文件无关;已用 stash 对比确认 master baseline exit 1。)Windows(交叉检查):
rustup target add x86_64-pc-windows-msvc成功。cargo check -p jcode-transport --target x86_64-pc-windows-msvc→Finished通过。cargo check -p jcode-companion --target x86_64-pc-windows-msvc无法在本机完成——aws-lc-sys 0.45.0 native build 需要 MSVC/Windows SDK 头文件(windows.h/stdlib.hnot found)。故 jcode-companion 的 E0596 修复为文本级核验(与 issue 建议的最小修法一致),待 CI Windows job 最终确认。AI 披露
本修复由 AI coding agent(GLM)辅助完成,经 akushonkamen 复核与测试(commit 中已含
Assisted-bytrailer)。