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
@@ -385,6 +385,7 @@ pub(crate) fn collect_loop_polygon(
|
||||
|
||||
/// All loops of a face: the outer boundary first, then any inner hole loops.
|
||||
/// Each loop is returned as an ordered 3-D polygon (≥ 3 points).
|
||||
#[cfg(feature = "solid3d")]
|
||||
pub(crate) fn collect_face_loops(
|
||||
sat: &SatDocument,
|
||||
face: &SatFace,
|
||||
|
||||
@@ -19,6 +19,7 @@ use truck_polymesh::PolygonMesh;
|
||||
// Chord-height tolerance used for adaptive curve sampling (world units).
|
||||
const CURVE_TOL: f64 = 0.005;
|
||||
// Triangle mesh tolerance (world units).
|
||||
#[allow(dead_code)]
|
||||
pub const MESH_TOL: f64 = 0.01;
|
||||
|
||||
// ── Zoom-adaptive curve tolerance override ────────────────────────────────
|
||||
|
||||
@@ -2429,6 +2429,7 @@ impl Scene {
|
||||
|
||||
/// Pick a meshed 3D solid by clicking on its shaded body (face), not just
|
||||
/// its thin projected edges. Returns the front-most mesh under `cursor`.
|
||||
#[allow(dead_code)]
|
||||
pub fn mesh_click_hit(
|
||||
&self,
|
||||
cursor: iced::Point,
|
||||
|
||||
@@ -106,6 +106,7 @@ pub struct HatchBatchedVertex {
|
||||
}
|
||||
|
||||
impl HatchBatchedVertex {
|
||||
#[allow(dead_code)]
|
||||
pub fn layout<'a>() -> wgpu::VertexBufferLayout<'a> {
|
||||
wgpu::VertexBufferLayout {
|
||||
array_stride: std::mem::size_of::<HatchBatchedVertex>() as u64,
|
||||
@@ -450,6 +451,7 @@ impl HatchBatchedGpu {
|
||||
/// constructed once at startup. All four bindings are read-only
|
||||
/// storage and visible to both VS (AABB+visibility lookup) and FS
|
||||
/// (boundary / family / dash sampling).
|
||||
#[allow(dead_code)]
|
||||
pub fn bind_group_layout(device: &wgpu::Device) -> wgpu::BindGroupLayout {
|
||||
let entry = |binding: u32| wgpu::BindGroupLayoutEntry {
|
||||
binding,
|
||||
|
||||
@@ -1001,7 +1001,7 @@ impl Pipeline {
|
||||
// O(highlighted), no per-wire string parse. Selection recolours blue,
|
||||
// hover orange. Drawn on top (depth-compare Always) over the base pass.
|
||||
let mut out: Vec<WireModel> = Vec::new();
|
||||
let mut push = |handle_val: u64, color: [f32; 4], wires: &[WireModel], out: &mut Vec<WireModel>| {
|
||||
let push = |handle_val: u64, color: [f32; 4], wires: &[WireModel], out: &mut Vec<WireModel>| {
|
||||
if let Some(idxs) = self.wire_handle_index.get(&handle_val) {
|
||||
let mut slots = idxs.clone();
|
||||
slots.sort_unstable();
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
|
||||
use crate::scene::model::wire_model::WireModel;
|
||||
use iced::wgpu;
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
use crate::par::prelude::*;
|
||||
|
||||
/// Allocate a VERTEX buffer with `mapped_at_creation` and write `data` directly
|
||||
|
||||
@@ -205,6 +205,7 @@ fn shape_cache() -> &'static Mutex<ShapeCache> {
|
||||
|
||||
/// Pixel font size the layout runs at. Positions and outlines are normalized
|
||||
/// out of pixel space afterwards, so the exact value only affects rounding.
|
||||
#[allow(dead_code)]
|
||||
const SHAPE_FS: f32 = 1000.0;
|
||||
|
||||
/// Shared cosmic-text layout engine, loaded once with the system fonts. Held
|
||||
|
||||
@@ -57,6 +57,7 @@ impl Script {
|
||||
/// 2 = Korean. Set from the active document's code page.
|
||||
static CJK_LANG: AtomicU8 = AtomicU8::new(0);
|
||||
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
fn cjk_lang() -> Script {
|
||||
match CJK_LANG.load(Ordering::Relaxed) {
|
||||
1 => Script::Japanese,
|
||||
@@ -83,6 +84,7 @@ pub fn set_cjk_lang_from_codepage(code_page: &str) -> bool {
|
||||
|
||||
/// The script font that covers `ch`, or `None` for control / uncovered code
|
||||
/// points. Ranges mirror the subset unicode ranges in `web/fonts/generate.sh`.
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
pub fn script_of(ch: char) -> Option<Script> {
|
||||
Some(match ch as u32 {
|
||||
0x0000..=0x024F | 0x1E00..=0x1EFF | 0x2000..=0x206F => Script::Latin,
|
||||
@@ -184,6 +186,8 @@ mod imp {
|
||||
use super::Script;
|
||||
use std::sync::Arc;
|
||||
|
||||
// Kept for parity with the wasm impl; only the wasm path has a caller.
|
||||
#[allow(dead_code)]
|
||||
pub fn request(_script: Script) -> Option<Arc<Vec<u8>>> {
|
||||
None
|
||||
}
|
||||
@@ -196,4 +200,7 @@ mod imp {
|
||||
}
|
||||
}
|
||||
|
||||
pub use imp::{fetch, insert, request, take_pending};
|
||||
pub use imp::{fetch, insert, take_pending};
|
||||
// `request` only has a caller in the wasm font-fallback path.
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
pub use imp::request;
|
||||
Reference in new issue
Block a user