Skip to content

armgit / cua

Public Imported from GitHub
0

Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.

chore(cua-driver-rs): cut the 5 remaining dead-code warnings from `cargo build` (#1714)

Francesco Bonacci65141f786fbe
diff --git a/libs/cua-driver/rust/crates/cua-driver/src/autostart.rs b/libs/cua-driver/rust/crates/cua-driver/src/autostart.rs
index 49441fbf2f..3e6d84a870 100644
--- a/libs/cua-driver/rust/crates/cua-driver/src/autostart.rs
+++ b/libs/cua-driver/rust/crates/cua-driver/src/autostart.rs
@@ -34,7 +34,16 @@ use anyhow::{anyhow, Result};
pub const TASK_NAME: &str = "cua-driver-serve";
/// Reported by `status`.
+///
+/// `#[allow(dead_code)]` on the variants because they're constructed
+/// only inside the `#[cfg(target_os = "windows")]` `platform::status`
+/// (schtasks-backed), while the enum itself is cross-platform — the
+/// non-Windows stub returns `Err(NOT_YET)` instead. The variants ARE
+/// reachable from `Status::tag` on every platform via the match, but
+/// rustc's dead-code analysis runs after cfg-stripping, so on
+/// macOS/Linux it sees the variants without a constructor and warns.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
+#[allow(dead_code)]
pub enum Status {
/// No autostart entry registered.
NotRegistered,
diff --git a/libs/cua-driver/rust/crates/cua-driver/src/skills.rs b/libs/cua-driver/rust/crates/cua-driver/src/skills.rs
index 04d95974dc..d6afa6e82f 100644
--- a/libs/cua-driver/rust/crates/cua-driver/src/skills.rs
+++ b/libs/cua-driver/rust/crates/cua-driver/src/skills.rs
@@ -175,6 +175,14 @@ enum AgentParent {
/// `<HOME or USERPROFILE>/<segment>`.
Home(&'static str),
/// `<APPDATA>/<segment>` (Windows roaming app config).
+ ///
+ /// `#[allow(dead_code)]`: constructed only inside `#[cfg(windows)]`
+ /// AGENTS entries (OpenCode on Windows reads from `%APPDATA%`) and
+ /// matched only inside `#[cfg(windows)]` arms of `parent_path`. The
+ /// enum variant itself sits in cross-platform code so rustc's
+ /// post-cfg-strip dead-code pass flags it on macOS/Linux even though
+ /// the Windows build uses it.
+ #[allow(dead_code)]
AppData(&'static str),
}
diff --git a/libs/cua-driver/rust/crates/platform-macos/src/permissions/panel.rs b/libs/cua-driver/rust/crates/platform-macos/src/permissions/panel.rs
index d83363d6eb..31c7ada6d3 100644
--- a/libs/cua-driver/rust/crates/platform-macos/src/permissions/panel.rs
+++ b/libs/cua-driver/rust/crates/platform-macos/src/permissions/panel.rs
@@ -227,7 +227,6 @@ const WIN_W: f64 = 460.0;
const WIN_H: f64 = 360.0;
const PAD: f64 = 20.0;
const ROW_H: f64 = 76.0;
-const BUTTON_BAR_H: f64 = 56.0;
const READY_STRIP_H: f64 = 36.0;
unsafe fn show_modal_unsafe(opts: &PanelOpts) -> PanelOutcome {
@@ -379,7 +378,6 @@ unsafe fn show_modal_unsafe(opts: &PanelOpts) -> PanelOutcome {
// ---- Stash handles for the timer callback ----
HANDLES.with(|cell| {
*cell.borrow_mut() = Some(PanelHandles {
- window: ptr_to_usize(window),
heading: ptr_to_usize(heading),
subheading: ptr_to_usize(subheading),
ready_strip: ptr_to_usize(ready_strip),
@@ -430,7 +428,6 @@ struct RowHandles {
}
struct PanelHandles {
- window: usize,
heading: usize,
subheading: usize,
ready_strip: usize,
diff --git a/libs/cua-driver/rust/crates/platform-macos/src/window_change_detector.rs b/libs/cua-driver/rust/crates/platform-macos/src/window_change_detector.rs
index aab84209e0..974d21045d 100644
--- a/libs/cua-driver/rust/crates/platform-macos/src/window_change_detector.rs
+++ b/libs/cua-driver/rust/crates/platform-macos/src/window_change_detector.rs
@@ -292,6 +292,14 @@ impl Snapshot {
/// Pure-function diff: given the snapshot's window-id set + a
/// list of currently-visible windows, return the (opened, closed)
/// classification.
+ ///
+ /// `#[allow(dead_code)]`: today only the `#[cfg(test)]` block below
+ /// constructs this — production callers `wait_for_window_change` /
+ /// `wait_for_window_close` keep the (opened, closed) split inline.
+ /// Kept `pub(crate)` because the doc comment near the top of this
+ /// `impl` block calls it out as the entry point for unit-testing the
+ /// diff logic without driving the live window enumerator.
+ #[allow(dead_code)]
pub(crate) fn diff(
snapshot_ids: &HashSet<u32>,
current: &[WindowInfo],