workspace: zero compiler warnings across all targets

254 warnings (320 counting replayed-cache re-emitters) cleaned:
unused mut/imports/variables, irrefutable if-lets and unreachable
patterns, dead code removed or annotated #[allow(dead_code)] with
the reason (C++ parity value sets, cfg(test) helpers, public API
reservations), drop(&ref) no-ops removed, fn-pointer identity via
std::ptr::fn_addr_eq, the test-stubs feature declared in
oak-node's manifest, missing docs filled. Every unused-Result site
was judged individually: meaningful errors propagate, intentional
ignores are let _ = with a note.

Two pre-existing latent bugs are documented in place, behavior
preserved: app.rs's timeline-tool observer and dialogs.rs's format
subscription both drop the returned Subscription immediately, so
they never fire.
This commit is contained in:
2026-09-11 16:38:44 +08:00
parent faebc79c31
commit 4f0f5cbba6
98 changed files with 409 additions and 455 deletions
-4
View File
@@ -276,8 +276,6 @@ fn global_ofx_host() -> *mut OfxHost {
/// kOfxActionLoad。
pub(crate) const ACTION_LOAD: &str = "OfxActionLoad";
/// kOfxActionUnload。
pub(crate) const ACTION_UNLOAD: &str = "OfxActionUnload";
/// kOfxActionDescribe。
pub(crate) const ACTION_DESCRIBE: &str = "OfxActionDescribe";
/// kOfxActionCreateInstance。
@@ -552,8 +550,6 @@ pub(crate) const PROP_CLIP_COLOURSPACE: &str = "OfxImageClipPropColourspace";
/// kOfxImageClipPropPreferredColourspaces(ofxColour.h:201):clip 偏好
/// 色彩空间(GetClipPreferences 的 out args 可写)。
pub(crate) const PROP_CLIP_PREFERRED_COLOURSPACES: &str = "OfxImageClipPropPreferredColourspaces";
/// 工作空间(任务要求:全链路 ACEScg)。
pub(crate) const WORKING_COLOURSPACE: &str = "ACEScg";
/// 宿主支持的 native 色彩配置标识(ofxColour.h:78 的唯一现行值)。
pub(crate) const NATIVE_CONFIG_ID: &str = "ofx-native-v1.5_aces-v1.3_ocio-v2.3";
/// 宿主 OCIO 配置 URI(ofxColour.h:110 允许 ocio:// 内建配置;本宿主
+1 -1
View File
@@ -1304,7 +1304,7 @@ mod tests {
) -> i32 {
0
}
let mut def = ParamDef::new("curve", ofx::TYPE_PARAMETRIC);
let def = ParamDef::new("curve", ofx::TYPE_PARAMETRIC);
def.props
.set_one(ofx::PROP_LABEL, PropValue::String(CString::new("Curve").unwrap()));
def.props
+1 -1
View File
@@ -362,7 +362,7 @@ impl ParamDef {
/// 按 OFX 类型构建定义(镜像 HS ofxhParam.cpp:224-352:
/// universalProps + addStandardParamProps 的分类型属性表)。
pub(crate) fn new(name: &str, ofx_type: &str) -> Self {
let mut props = PropertySet::new();
let props = PropertySet::new();
let uname = name.to_string();
let utype = ofx_type.to_string();
+1 -1
View File
@@ -505,7 +505,7 @@ mod tests {
/// 重复定义整体替换(HS map 覆盖)。
#[test]
fn describe_clip_define_and_props() {
let mut desc = EffectDescriptor::new();
let desc = EffectDescriptor::new();
let s = suite_v1();
let h = descriptor_handle(&desc);
-4
View File
@@ -490,10 +490,6 @@ mod tests {
use std::ffi::{c_char, CStr};
use std::sync::Mutex;
fn cs(s: &str) -> CString {
CString::new(s).unwrap()
}
/// interact 属性表:PixelScale/ViewportSize/SuggestedColour/
/// SlaveToParam/BitDepth/HasAlpha 等按头文件预置,经 property suite
/// 可读写。
-11
View File
@@ -81,17 +81,6 @@ pub(crate) fn free(ptr: *mut u8) -> bool {
}
}
/// 兜底回收全部在账块(destroyInstance 的泄漏防线)。返回回收块数
/// (泄漏断言用)。
pub(crate) fn sweep_leaked() -> usize {
let mut ledger = lock();
let n = ledger.len();
for b in ledger.drain(..) {
unsafe { std::alloc::dealloc(b.ptr as *mut u8, b.layout) };
}
n
}
/// 函数表布局(与 SDK `OfxMemorySuiteV1` 一致;`size_t` 在本平台
/// 与 `usize` 同宽,stable Rust 用 `usize` 表达——骨架的 `c_size_t`
/// 是不稳定特性,弃用)。
-3
View File
@@ -212,9 +212,6 @@ pub(crate) fn gl_ctx() -> Option<GlCtx> {
GL_CTX.with(|c| c.borrow().clone())
}
/// 宿主进程身份(fetchSuite 的 version 检查用;= OFX API 1.5)。
pub(crate) const OFX_API_VERSION: i32 = 105;
/// fetchSuite 宿主入口:按名字与版本返回函数表指针;不认识或版本
/// 不符返回 `None`(FFI 层转 NULL)。
///
@@ -260,7 +260,6 @@ pub fn suite_v1() -> &'static MultiThreadSuiteV1 {
mod tests {
use super::*;
use std::sync::atomic::{AtomicUsize, Ordering};
use std::sync::Mutex;
/// 每个插件线程把 (index, count) 累计进 userdata。
unsafe extern "C" fn worker(index: c_uint, count: c_uint, arg: *mut c_void) {
+2 -2
View File
@@ -787,7 +787,7 @@ mod tests {
/// 用 paramDefine 建一个实例(describe 产物 → createInstance)。
fn make_instance() -> (Arc<Instance>, *mut c_void) {
let mut desc = EffectDescriptor::new();
let desc = EffectDescriptor::new();
let s = suite_v1();
let dhandle = descriptor_handle(&desc);
unsafe {
@@ -836,7 +836,7 @@ mod tests {
#[test]
fn describe_define_and_get() {
let mut desc = EffectDescriptor::new();
let desc = EffectDescriptor::new();
let s = suite_v1();
let handle = descriptor_handle(&desc);
let t = cs("OfxParamTypeDouble");
+4 -4
View File
@@ -42,10 +42,8 @@
//! BadHandle/BadIndex)。
use std::borrow::Cow;
use std::ffi::{c_char, c_double, c_int, c_void};
use std::ffi::{c_double, c_int, c_void};
use crate::descriptor::EffectDescriptor;
use crate::instance::Instance;
use crate::param::{ParamDef, ParamInstance, ParamValue};
use crate::param_curve::Curve;
use crate::property::{PropertySet, Value};
@@ -414,10 +412,12 @@ pub fn suite_v1() -> &'static ParametricParameterSuiteV1 {
#[cfg(test)]
mod tests {
use super::*;
use std::ffi::CString;
use std::ffi::{c_char, CString};
use std::sync::Arc;
use crate::descriptor::EffectDescriptor;
use crate::host::Plugin;
use crate::instance::Instance;
use crate::param::{ParamInstance, ParamSetInstance};
use crate::property::PropertySet;
+1 -1
View File
@@ -498,7 +498,7 @@ unsafe extern "C" fn prop_get_string(
let r = get_string(set, name, index);
if std::env::var_os("OAK_OFX_TRACE").is_some() {
let rendered = match &r {
Ok(p) => format!("0 <- {:?}", unsafe { std::ffi::CStr::from_ptr(*p) }),
Ok(p) => format!("0 <- {:?}", std::ffi::CStr::from_ptr(*p)),
Err(c) => format!("{c}"),
};
eprintln!("[ofx] propGetString(h={handle:p}, {name}[{index}]) -> {rendered}");