clippy: clear the workspace errors and apply the machine fixes

- Mark the raw-pointer interop entry points unsafe with # Safety docs
  (oak-core upload/download/frame-from-pixels, oak-audio convert) and
  satisfy the existing callers (tests).
- mut_from_ref: allow with the ABI contract documented (the handle
  get_mut helpers in oak-timeline/oak-render/oak-task take the shared
  reference the C ABI passes; exclusivity is the caller's unsafe
  contract).
- Fix the eq_op in the white-balance normalization (green / green).
- Apply cargo clippy --fix across the workspace (redundant closures and
  field names, field reassignment, items after test modules, ...).
- Revert the replace_box fix in image_effect's clip_define: a
  redefinition must allocate a new box, otherwise the old clip handle
  stays valid and the HS-map replace contract (clip != clip2) breaks.
- 283 warnings remain; they are all non-machine-applicable
  (chunks_exact -> as_chunks needs a manual iter_mut, too_many_arguments,
  complex types, missing Safety docs, ...) and are tracked as the
  follow-up.
This commit is contained in:
2026-09-15 19:29:32 +08:00
parent 7e87ec135e
commit ee7ea18d94
146 changed files with 5235 additions and 4046 deletions
+5
View File
@@ -130,6 +130,11 @@ pub unsafe fn get<T: 'static>(h: &CHandle) -> Option<&T> {
/// `T` must be the boxed type, and the caller must guarantee exclusive
/// access to the boxed value for the duration of the borrow (no two
/// mutable views alive at once).
// The shared reference is the ABI input; exclusivity is the caller's
// `unsafe` contract above, so the lint's usual aliasing concern is
// discharged by the caller, not by `&mut CHandle` (which the C ABI does
// not pass).
#[allow(clippy::mut_from_ref)]
pub unsafe fn get_mut<T: 'static>(h: &CHandle) -> Option<&mut T> {
if h.ctx.is_null() {
return None;
File diff suppressed because it is too large Load Diff
+4 -4
View File
@@ -111,9 +111,9 @@ impl WorkareaSetEnabledCommand {
let wa = unsafe { get::<Arc<Mutex<TimelineWorkArea>>>(&points) }.cloned();
let old_enabled = wa
.as_ref()
.and_then(|w| {
.map(|w| {
let w = w.lock().unwrap_or_else(|e| e.into_inner());
Some(w.enabled())
w.enabled()
})
.unwrap_or(false);
Self {
@@ -187,9 +187,9 @@ impl WorkareaSetRangeCommand {
let wa = unsafe { get::<Arc<Mutex<TimelineWorkArea>>>(&workarea) }.cloned();
let old_range = wa
.as_ref()
.and_then(|w| {
.map(|w| {
let w = w.lock().unwrap_or_else(|e| e.into_inner());
Some(*w.range())
*w.range()
})
.unwrap_or(range);
Self::new_with_old_opt(wa, range, old_range)