diff --git a/Cargo.lock b/Cargo.lock index 4920186..ed9da05 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -228,7 +228,7 @@ version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" dependencies = [ - "windows-sys 0.61.2", + "windows-sys 0.60.2", ] [[package]] @@ -251,7 +251,7 @@ checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" dependencies = [ "anstyle", "once_cell_polyfill", - "windows-sys 0.61.2", + "windows-sys 0.60.2", ] [[package]] @@ -1810,7 +1810,7 @@ version = "3.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "faf9468729b8cbcea668e36183cb69d317348c2e08e994829fb56ebfdfbaac34" dependencies = [ - "windows-sys 0.61.2", + "windows-sys 0.48.0", ] [[package]] @@ -2654,7 +2654,7 @@ dependencies = [ "libc", "option-ext", "redox_users 0.5.2", - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -2980,7 +2980,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", - "windows-sys 0.61.2", + "windows-sys 0.52.0", ] [[package]] @@ -3958,7 +3958,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b305d85504de270ad3525d726a6b69cc59ee7b2269b014387651107ab9f0755b" dependencies = [ "bstr", - "hashbrown 0.17.1", + "hashbrown 0.15.5", ] [[package]] @@ -4497,9 +4497,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.4.15" +version = "0.4.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6cb093c84e8bd9b188d4c4a8cb6579fc016968d14c99882163cd3ff402a4f155" +checksum = "ef8e5e5a340588f4452631496976cf8636d4a7ecf600239fdc27615d2530bc16" dependencies = [ "atomic-waker", "bytes", @@ -7305,7 +7305,7 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "536bfad37a309d62069485248eeaba1e8d9853aaf951caaeaed0585a95346f08" dependencies = [ - "windows-sys 0.61.2", + "windows-sys 0.60.2", ] [[package]] @@ -7576,7 +7576,7 @@ version = "0.50.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5" dependencies = [ - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -7997,7 +7997,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7d8fae84b431384b68627d0f9b3b1245fcf9f46f6c0e3dc902e9dce64edd1967" dependencies = [ "libc", - "windows-sys 0.61.2", + "windows-sys 0.48.0", ] [[package]] @@ -8992,7 +8992,7 @@ dependencies = [ "once_cell", "socket2", "tracing", - "windows-sys 0.61.2", + "windows-sys 0.52.0", ] [[package]] @@ -9617,7 +9617,7 @@ dependencies = [ "errno", "libc", "linux-raw-sys 0.12.1", - "windows-sys 0.61.2", + "windows-sys 0.52.0", ] [[package]] @@ -9687,7 +9687,7 @@ dependencies = [ "security-framework 3.7.0", "security-framework-sys", "webpki-root-certs", - "windows-sys 0.61.2", + "windows-sys 0.52.0", ] [[package]] @@ -10536,7 +10536,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3d1e2c7f27f8d4cb10542a02c49005dbd6e93095799d6f3be745fae9f8fedd4" dependencies = [ "libc", - "windows-sys 0.61.2", + "windows-sys 0.60.2", ] [[package]] @@ -10937,7 +10937,7 @@ dependencies = [ "getrandom 0.4.3", "once_cell", "rustix 1.1.4", - "windows-sys 0.61.2", + "windows-sys 0.52.0", ] [[package]] @@ -11882,7 +11882,7 @@ checksum = "f2f6fb2847f6742cd76af783a2a2c49e9375d0a111c7bef6f71cd9e738c72d6e" dependencies = [ "memoffset", "tempfile", - "windows-sys 0.61.2", + "windows-sys 0.60.2", ] [[package]] @@ -12414,15 +12414,15 @@ dependencies = [ [[package]] name = "webbrowser" -version = "1.2.1" +version = "1.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fc95580916af1e68ff6a7be07446fc5db73ebf71cf092de939bbf5f7e189f72" +checksum = "62c35be770821a214dbc362fc26908c853e776c0004294d0b10b8a6bad582f94" dependencies = [ - "core-foundation 0.10.1", "jni", "log", "ndk-context", "objc2 0.6.4", + "objc2-app-kit", "objc2-foundation 0.3.2", "url", "web-sys", @@ -12561,7 +12561,7 @@ version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" dependencies = [ - "windows-sys 0.61.2", + "windows-sys 0.48.0", ] [[package]] diff --git a/crates/codegen/kigi-fast-worktree/src/copy/cow.rs b/crates/codegen/kigi-fast-worktree/src/copy/cow.rs index 09d082b..c79a998 100644 --- a/crates/codegen/kigi-fast-worktree/src/copy/cow.rs +++ b/crates/codegen/kigi-fast-worktree/src/copy/cow.rs @@ -76,6 +76,7 @@ mod tests { assert_eq!(std::fs::read(&dest).unwrap(), data); } + #[cfg(unix)] #[test] fn test_clone_preserves_permissions() { use std::os::unix::fs::PermissionsExt; diff --git a/crates/codegen/kigi-fast-worktree/src/worktree/mod.rs b/crates/codegen/kigi-fast-worktree/src/worktree/mod.rs index e29b141..2fb012f 100644 --- a/crates/codegen/kigi-fast-worktree/src/worktree/mod.rs +++ b/crates/codegen/kigi-fast-worktree/src/worktree/mod.rs @@ -37,6 +37,7 @@ pub(crate) fn execute_plan(plan: WorktreePlan) -> Result { #[cfg(test)] mod tests { + #[cfg(unix)] use super::*; use crate::{IgnoredFilesMode, WorkingTreeMode, WorktreeBuilder}; use kigi_test_utils::git::{git_commit_all, init_git_repo}; diff --git a/crates/codegen/kigi-file-utils/src/workspace_classifier.rs b/crates/codegen/kigi-file-utils/src/workspace_classifier.rs index 4d25f3f..eccf45a 100644 --- a/crates/codegen/kigi-file-utils/src/workspace_classifier.rs +++ b/crates/codegen/kigi-file-utils/src/workspace_classifier.rs @@ -89,10 +89,10 @@ fn is_platform_system_dir(cwd: &Path) -> bool { #[cfg(target_os = "windows")] fn is_platform_system_dir(cwd: &Path) -> bool { - if let Ok(temp) = std::env::var("TEMP").or_else(|_| std::env::var("TMP")) { - if cwd.starts_with(&temp) { - return true; - } + if let Ok(temp) = std::env::var("TEMP").or_else(|_| std::env::var("TMP")) + && cwd.starts_with(&temp) + { + return true; } let path_lower = cwd.to_string_lossy().to_lowercase(); @@ -103,7 +103,7 @@ fn is_platform_system_dir(cwd: &Path) -> bool { return true; } - if cwd.parent().map_or(false, |p| p.parent().is_none()) && cwd.to_string_lossy().len() <= 3 { + if cwd.parent().is_some_and(|p| p.parent().is_none()) && cwd.to_string_lossy().len() <= 3 { return true; } diff --git a/crates/codegen/kigi-hunk-tracker/src/actor/file_utils.rs b/crates/codegen/kigi-hunk-tracker/src/actor/file_utils.rs index eea433f..1e82934 100644 --- a/crates/codegen/kigi-hunk-tracker/src/actor/file_utils.rs +++ b/crates/codegen/kigi-hunk-tracker/src/actor/file_utils.rs @@ -318,6 +318,7 @@ mod tests { assert!(matches!(state, FileContentState::TooLarge { .. })); } + #[cfg(unix)] #[tokio::test] async fn test_read_file_bounded_symlink() { let dir = tempfile::tempdir().unwrap(); diff --git a/crates/codegen/kigi-mermaid/src/mmdc.rs b/crates/codegen/kigi-mermaid/src/mmdc.rs index 8f86229..d0df054 100644 --- a/crates/codegen/kigi-mermaid/src/mmdc.rs +++ b/crates/codegen/kigi-mermaid/src/mmdc.rs @@ -150,6 +150,7 @@ fn write_private(path: &Path, contents: &str) -> std::io::Result<()> { #[cfg(test)] mod tests { use super::*; + #[cfg(unix)] use std::time::Instant; /// Write an executable `#!/bin/sh` fake `mmdc` and return (dir-guard, path). diff --git a/crates/codegen/kigi-mermaid/src/subprocess.rs b/crates/codegen/kigi-mermaid/src/subprocess.rs index 844745c..939fb15 100644 --- a/crates/codegen/kigi-mermaid/src/subprocess.rs +++ b/crates/codegen/kigi-mermaid/src/subprocess.rs @@ -179,9 +179,12 @@ fn reap_process_group(_child: &Child) { #[cfg(test)] mod tests { use super::*; + #[cfg(unix)] use std::process::Stdio; + #[cfg(unix)] use std::time::Instant; + #[cfg(unix)] fn detached(mut cmd: Command) -> Command { cmd.stdin(Stdio::null()) .stdout(Stdio::null()) diff --git a/crates/codegen/kigi-pager-render/src/link_opener.rs b/crates/codegen/kigi-pager-render/src/link_opener.rs index d2b8efe..f2047a0 100644 --- a/crates/codegen/kigi-pager-render/src/link_opener.rs +++ b/crates/codegen/kigi-pager-render/src/link_opener.rs @@ -214,6 +214,7 @@ pub fn open_url_if_safe(url: &str, filter: SchemeFilter) -> bool { mod tests { use super::*; + #[cfg(not(target_os = "windows"))] #[test] fn open_path_command_passes_path_as_a_single_arg() { // Path with spaces must be one argument, never shell-interpolated. diff --git a/crates/codegen/kigi-pager-render/src/terminal/probe.rs b/crates/codegen/kigi-pager-render/src/terminal/probe.rs index 3b82aea..f235269 100644 --- a/crates/codegen/kigi-pager-render/src/terminal/probe.rs +++ b/crates/codegen/kigi-pager-render/src/terminal/probe.rs @@ -10,6 +10,7 @@ //! portable re-injection exists (TIOCSTI is blocked); accepted loss. use std::io::Write; +#[cfg(unix)] use std::time::Duration; /// Bounds the reply buffer against terminals that stream without a terminator. diff --git a/crates/codegen/kigi-shared/src/clipboard.rs b/crates/codegen/kigi-shared/src/clipboard.rs index c99eaa4..818ebfa 100644 --- a/crates/codegen/kigi-shared/src/clipboard.rs +++ b/crates/codegen/kigi-shared/src/clipboard.rs @@ -1164,6 +1164,7 @@ mod platform { #[cfg(not(target_os = "macos"))] mod platform { use super::ImageData; + #[cfg(target_os = "linux")] use std::process::{Command, Stdio}; /// No subprocess-free pasteboard probe exists off-macOS. @@ -1926,19 +1927,18 @@ mod platform { // Public API pub fn get_text() -> anyhow::Result> { - let mut arboard_error = None; - match arboard_get_text() { + let arboard_error = match arboard_get_text() { Ok(Some(text)) => return Ok(Some(text)), // Wayland-only: arboard's empty answer is not authoritative, // fall through to wl-paste (see `wayland_tool_selected`). #[cfg(target_os = "linux")] - Ok(None) if wayland_tool_selected(linux_tool_spec()) => {} + Ok(None) if wayland_tool_selected(linux_tool_spec()) => None, Ok(None) => return Ok(None), Err(e) => { tracing::debug!("arboard get_text failed: {e}"); - arboard_error = Some(e); + Some(e) } - } + }; #[cfg(target_os = "linux")] if let Some(spec) = linux_tool_spec() { let bytes = run_capture_out_checked(spec.read_text, CLI_READ_WAIT)?; @@ -2039,19 +2039,18 @@ mod platform { } pub fn get_image() -> anyhow::Result> { - let mut arboard_error = None; - match arboard_get_image() { + let arboard_error = match arboard_get_image() { Ok(Some(image)) => return Ok(Some(image)), // Wayland-only: arboard's empty answer is not authoritative, // fall through to wl-paste (see `wayland_tool_selected`). #[cfg(target_os = "linux")] - Ok(None) if wayland_tool_selected(linux_tool_spec()) => {} + Ok(None) if wayland_tool_selected(linux_tool_spec()) => None, Ok(None) => return Ok(None), Err(e) => { tracing::debug!("arboard get_image failed: {e}"); - arboard_error = Some(e); + Some(e) } - } + }; #[cfg(target_os = "linux")] if let Some(spec) = linux_tool_spec() && let Some(argv) = spec.read_png diff --git a/crates/codegen/kigi-tools/src/computer/local/terminal.rs b/crates/codegen/kigi-tools/src/computer/local/terminal.rs index b6653ad..c00cf74 100644 --- a/crates/codegen/kigi-tools/src/computer/local/terminal.rs +++ b/crates/codegen/kigi-tools/src/computer/local/terminal.rs @@ -2653,7 +2653,7 @@ fn spawn_shell_command( }; #[cfg(not(unix))] - let mut build_cmd = |with_breakaway: bool| { + let build_cmd = |with_breakaway: bool| { use windows::Win32::System::Threading::{ CREATE_BREAKAWAY_FROM_JOB, CREATE_NEW_PROCESS_GROUP, CREATE_NO_WINDOW, }; diff --git a/crates/codegen/kigi-tui/src/app/mod.rs b/crates/codegen/kigi-tui/src/app/mod.rs index a7acc7a..d5a3b16 100644 --- a/crates/codegen/kigi-tui/src/app/mod.rs +++ b/crates/codegen/kigi-tui/src/app/mod.rs @@ -813,11 +813,11 @@ pub(crate) mod win_native_selection { let Ok(saved) = u32::try_from(saved) else { return; }; - if let Some((handle, current)) = stdin_console_mode() { - if current != saved { - unsafe { - let _ = SetConsoleMode(handle, saved); - } + if let Some((handle, current)) = stdin_console_mode() + && current != saved + { + unsafe { + let _ = SetConsoleMode(handle, saved); } } } diff --git a/crates/codegen/kigi-tui/tests/pty_e2e_scroll_selection.rs b/crates/codegen/kigi-tui/tests/pty_e2e_scroll_selection.rs index 7d273ad..cfd0648 100644 --- a/crates/codegen/kigi-tui/tests/pty_e2e_scroll_selection.rs +++ b/crates/codegen/kigi-tui/tests/pty_e2e_scroll_selection.rs @@ -66,5 +66,6 @@ mod wheel_flood_paints_no_ghost_frames; mod wheel_overscroll_at_bottom_reengages_follow_mid_stream; #[path = "pty_e2e/wheel_scrolls_viewport_during_streaming_turn.rs"] mod wheel_scrolls_viewport_during_streaming_turn; +#[cfg(unix)] #[path = "pty_e2e/word_select_tip_on_double_click_pty.rs"] mod word_select_tip_on_double_click_pty; diff --git a/crates/codegen/kigi-tui/tests/pty_e2e_shell_tools.rs b/crates/codegen/kigi-tui/tests/pty_e2e_shell_tools.rs index 57afaa1..aeab7a2 100644 --- a/crates/codegen/kigi-tui/tests/pty_e2e_shell_tools.rs +++ b/crates/codegen/kigi-tui/tests/pty_e2e_shell_tools.rs @@ -11,10 +11,12 @@ mod common; #[path = "pty_e2e/scroll.rs"] mod scroll; +#[cfg(unix)] #[path = "pty_e2e/bash_mode_file_completion_shell_like.rs"] mod bash_mode_file_completion_shell_like; #[path = "pty_e2e/bash_mode_strips_redundant_session_cd_from_chrome.rs"] mod bash_mode_strips_redundant_session_cd_from_chrome; +#[cfg(unix)] #[path = "pty_e2e/bash_mode_tab_completion_dropdown.rs"] mod bash_mode_tab_completion_dropdown; #[path = "pty_e2e/edit_collapsed_oneliner_pty.rs"] diff --git a/crates/codegen/kigi-workspace/src/foreign_sessions/capability/mod.rs b/crates/codegen/kigi-workspace/src/foreign_sessions/capability/mod.rs index 8ebc81d..f699f44 100644 --- a/crates/codegen/kigi-workspace/src/foreign_sessions/capability/mod.rs +++ b/crates/codegen/kigi-workspace/src/foreign_sessions/capability/mod.rs @@ -224,11 +224,11 @@ impl ApprovedRoot { { return None; } - return Some(OpenedRegularFile { + Some(OpenedRegularFile { file, path: canonical_path, metadata, - }); + }) } #[cfg(not(any(unix, windows)))] {