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
+5 -21
View File
@@ -70,8 +70,13 @@ use crate::footagedescription::{FootageDescription, StreamEntry};
use crate::frame::Frame;
/// `oak_core_COLOR_RANGE_FULL`.
///
/// Both range constants keep the C ABI's spelling (they name the frozen
/// `oak_core_COLOR_RANGE_*` values), hence the lint allowance.
#[allow(non_upper_case_globals)]
const oak_core_COLOR_RANGE_FULL: i32 = 1;
/// `oak_core_COLOR_RANGE_LIMITED`.
#[allow(non_upper_case_globals)]
const oak_core_COLOR_RANGE_LIMITED: i32 = 0;
/// `AVCOL_RANGE_JPEG` (full range; AVCOL_RANGE_MPEG = 1 is limited).
const AVCOL_RANGE_JPEG: i32 = 2;
@@ -1899,27 +1904,6 @@ fn convert_rgba_f32_le(data: &[u8], w: u32, h: u32, stride: usize) -> Vec<u8> {
out
}
/// Copy a packed u16-RGBA buffer (RGBA64LE) into F32 RGBA bytes.
fn convert_rgba64_to_f32(data: &[u8], w: u32, h: u32, stride: usize) -> Vec<u8> {
let mut out = vec![0u8; (w as usize) * (h as usize) * PIXEL_F32_BYTES];
for y in 0..h as usize {
let row = &data[y * stride..y * stride + (w as usize) * 8];
let dst =
&mut out[y * (w as usize) * PIXEL_F32_BYTES..(y + 1) * (w as usize) * PIXEL_F32_BYTES];
for (px, src_px) in dst
.chunks_exact_mut(PIXEL_F32_BYTES)
.zip(row.chunks_exact(8))
{
for c in 0..3 {
let v = u16::from_le_bytes([src_px[c * 2], src_px[c * 2 + 1]]);
px[c * 4..c * 4 + 4].copy_from_slice(&(v as f32 / 65535.0).to_le_bytes());
}
px[12..16].copy_from_slice(&1.0f32.to_le_bytes());
}
}
out
}
/// Copy a packed 8-bit RGBA buffer into F32 RGBA bytes (the universal
/// swscale fallback; M12 P0 — some static FFmpeg swscale builds lack
/// float output formats).
+3
View File
@@ -97,6 +97,9 @@ impl ProxyParams {
cstr_slice(&self.extension)
}
/// Only the proxy-params tests read the preset through this accessor
/// (the struct field itself is `pub`).
#[allow(dead_code)]
fn preset_str(&self) -> &str {
cstr_slice(&self.preset)
}
+6
View File
@@ -107,6 +107,10 @@ enum SubmitCb {
/// No callback registered.
None,
/// Extern-C callback registered via `oakcodec_set_task_submit_cb`.
///
/// Only constructed by the tests below and by the extern-C entry point
/// that the removed C ABI used to expose; kept for that lane.
#[allow(dead_code)]
Extern {
/// The C function pointer.
cb: OakCodecTaskSubmitFn,
@@ -151,6 +155,8 @@ pub fn set_task_submit_cb(cb: Option<&'static TaskSubmitFn>, userdata: *mut std:
/// Register an extern-C submit callback (used by `ffi::task`).
///
/// Mirrors `oakcodec_set_task_submit_cb`: a `None` pointer clears it.
/// Only the tests below call it (the extern-C lane is exercised there).
#[allow(dead_code)]
pub(crate) fn set_task_submit_cb_extern(
cb: Option<OakCodecTaskSubmitFn>,
userdata: *mut std::ffi::c_void,