From 59711d61f38eed5f059af039ad2915d7bd864426 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Wed, 28 Oct 2026 22:10:27 -0700 Subject: [PATCH] macOS: the app builds and passes clippy again after main.rs was split `cargo build -p vectorcraft` on macOS stops with nine E0433 errors: app.rs and host_services.rs use `mac_menu`, `mac_window`, `open_documents`, `gpu`, `mac_save_format`, `mac_tablet` and `mac_screen_color` without importing them since those items moved out of main.rs. The two files now import them under the same cfg as the code that uses them. `cargo clippy -p vectorcraft --all-targets -- -D warnings` on macOS then stops at the wildcard import in clipboard.rs's macOS module, which now names the two items it uses. Other platforms compile the same code as before. --- apps/vectorcraft/src/app.rs | 4 ++++ apps/vectorcraft/src/clipboard.rs | 2 +- apps/vectorcraft/src/host_services.rs | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/apps/vectorcraft/src/app.rs b/apps/vectorcraft/src/app.rs index 3161d1a37..acb1f2c04 100644 --- a/apps/vectorcraft/src/app.rs +++ b/apps/vectorcraft/src/app.rs @@ -1,7 +1,11 @@ +#[cfg(all(target_os = "macos", feature = "accessibility", feature = "wgpu"))] +use super::gpu; use super::prefs::save_prefs; #[cfg(all(windows, not(target_vendor = "win7")))] use super::windows_stylus; use super::{App, VectorcraftApp, file_access, window}; +#[cfg(target_os = "macos")] +use super::{mac_menu, mac_window, open_documents}; /// The parts of [`App::raw_input_hook`] that every window needs, for the OS windows of floating /// panels: a click or Escape that closes the macOS menu bar's open menu, and the pen barrel diff --git a/apps/vectorcraft/src/clipboard.rs b/apps/vectorcraft/src/clipboard.rs index 0b228f62c..ef3832f1e 100644 --- a/apps/vectorcraft/src/clipboard.rs +++ b/apps/vectorcraft/src/clipboard.rs @@ -415,7 +415,7 @@ mod mac { use objc2_app_kit::NSPasteboard; use objc2_foundation::{NSArray, NSString}; - use super::*; + use super::{Flavour, pasteboard_types}; /// Does the pasteboard hold one of `mimes` ([`pasteboard_types`])? Asks for its types only. pub fn has(mimes: &[&'static str]) -> bool { diff --git a/apps/vectorcraft/src/host_services.rs b/apps/vectorcraft/src/host_services.rs index 014782ed4..4254d1591 100644 --- a/apps/vectorcraft/src/host_services.rs +++ b/apps/vectorcraft/src/host_services.rs @@ -5,6 +5,8 @@ use super::tablet; #[cfg(all(windows, not(target_vendor = "win7")))] use super::windows_stylus; use super::{ClipboardProbeFactory, FilePick, PickRequest, Services, clipboard, cursor_theme, fileio, printing}; +#[cfg(target_os = "macos")] +use super::{mac_save_format, mac_screen_color, mac_tablet}; /// The window file dialogs belong to. pub(crate) type Parent = Option>;