solidcraft-smlib: the curve list carries nothing in a build without SMLib

Without the native feature nothing reads a sweep's curve list, and clippy -D warnings
refused its two fields as dead code. The list is built through List::new in both builds;
only the native build keeps the slices the C API reads.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017itGh5fpMEousnZ91cYcVt
This commit is contained in:
jyviko
2026-10-21 14:12:58 -04:00
parent 22cfc69c02
commit 69ad1ae450
2 changed files with 21 additions and 5 deletions
+20 -4
View File
@@ -22,11 +22,27 @@ pub const SWEEP_FOLLOW: i32 = 0;
pub const SWEEP_TRANSLATE: i32 = 1;
/// A curve list as the C API reads it: kinds (with a NURBS curve's degree and point count) and
/// each curve's numbers. Only the calls read them, which a build without SMLib does not have.
#[cfg_attr(not(feature = "native"), allow(dead_code))]
/// each curve's numbers.
#[cfg(feature = "native")]
pub struct List<'a> {
pub kinds: &'a [i64],
pub reals: &'a [f64],
kinds: &'a [i64],
reals: &'a [f64],
}
/// Without SMLib nothing reads the list, so it carries nothing.
#[cfg(not(feature = "native"))]
pub struct List<'a>(std::marker::PhantomData<&'a ()>);
impl<'a> List<'a> {
#[cfg(feature = "native")]
pub fn new(kinds: &'a [i64], reals: &'a [f64]) -> Self {
List { kinds, reals }
}
#[cfg(not(feature = "native"))]
pub fn new(_: &'a [i64], _: &'a [f64]) -> Self {
List(std::marker::PhantomData)
}
}
#[cfg(feature = "native")]
+1 -1
View File
@@ -99,7 +99,7 @@ impl List {
}
fn raw(&self) -> ffi::sweeps::List<'_> {
ffi::sweeps::List { kinds: &self.kinds, reals: &self.reals }
ffi::sweeps::List::new(&self.kinds, &self.reals)
}
}