forked from 1b-agent/opencadstudio-upstream
chore: silence native and wasm build warnings
Gate target-specific code so neither build warns about the other's items: native-only helpers (view, window icon, file dialogs, file association, plugin host/guard/registry, self-update) are cfg'd to non-wasm; the wasm-only font fallback (script_of / cjk_lang / request) is cfg'd to wasm. Drop an unused mut, allow the few genuinely-conditional dead items (mesh_click_hit, GPU layout helpers, parity stubs), and gate the embedded PlotSettings-unrelated dead constants. Both targets now build clean (only the unavoidable nom/quick-xml future-incompat dependency notice remains). Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
1 parent
2de5c7668f
commit
10e4c18ba7
20 files changed
+37
-2
No files matched your search
@@ -159,6 +159,7 @@ pub(super) struct DocumentTab {
|
||||
/// rest of the code can treat it as a normal tab when reading.
|
||||
pub(super) is_start: bool,
|
||||
/// Per-plugin document state (`plugin::BuiltinPlugin` manifest id → state).
|
||||
#[cfg_attr(target_arch = "wasm32", allow(dead_code))]
|
||||
pub(super) plugin_state: HashMap<&'static str, Box<dyn Any + Send + Sync>>,
|
||||
pub(super) suspended_cmd: Option<Box<dyn CadCommand>>,
|
||||
}
|
||||
|
||||
@@ -286,6 +286,7 @@ pub(super) fn title_case_word(value: &str) -> String {
|
||||
// ── Window icon ────────────────────────────────────────────────────────────
|
||||
|
||||
/// Builds a 32×32 RGBA icon: red background with OCS drawn in white pixels.
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
pub(super) fn build_window_icon() -> Vec<u8> {
|
||||
const W: usize = 32;
|
||||
const SZ: usize = W * W * 4;
|
||||
|
||||
@@ -11,6 +11,7 @@ mod history;
|
||||
mod layers;
|
||||
mod model_ops;
|
||||
mod mtext_editor;
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
pub mod plugin_host;
|
||||
mod properties;
|
||||
mod settings;
|
||||
@@ -819,6 +820,7 @@ pub enum ModalKind {
|
||||
DimStyle,
|
||||
Unsaved,
|
||||
SaveDialog,
|
||||
#[cfg_attr(target_arch = "wasm32", allow(dead_code))]
|
||||
AssocPrompt,
|
||||
PointStyle,
|
||||
}
|
||||
@@ -2020,6 +2022,7 @@ impl OpenCADStudio {
|
||||
/// open. Secondary manager windows are unavailable on the web for now.
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
fn boot_web() -> (Self, Task<Message>) {
|
||||
#[cfg_attr(target_arch = "wasm32", allow(unused_mut))]
|
||||
let mut s = Self::new();
|
||||
let focus = s.focus_cmd_input();
|
||||
(s, focus)
|
||||
|
||||
@@ -238,6 +238,7 @@ impl OpenCADStudio {
|
||||
|
||||
/// Snapshot of disabled plugin ids — lets the registry skip them while it
|
||||
/// holds a `&mut` borrow of the app via `HostSession`.
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
pub(crate) fn disabled_plugin_ids(&self) -> rustc_hash::FxHashSet<String> {
|
||||
self.disabled_plugins.clone()
|
||||
}
|
||||
|
||||
@@ -38,6 +38,7 @@ impl std::fmt::Display for RenderModeChoice {
|
||||
}
|
||||
|
||||
impl OpenCADStudio {
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
pub fn view(&self, window_id: window::Id) -> Element<'_, Message> {
|
||||
// ── Floating panel windows ─────────────────────────────────────────
|
||||
// All dialogs are in-canvas modals now (Plan B); view_main stacks the
|
||||
@@ -3893,6 +3894,7 @@ pub(super) fn start_page_view<'a>() -> Element<'a, Message> {
|
||||
.spacing(12)
|
||||
.align_y(iced::Center);
|
||||
|
||||
#[cfg_attr(target_arch = "wasm32", allow(unused_mut))]
|
||||
let mut secondary_row = row![
|
||||
outline_btn(
|
||||
"Send Feedback",
|
||||
|
||||
Reference in new issue
Block a user