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 -5
View File
@@ -347,7 +347,7 @@ mod tests {
// deterministic on the queued inline dispatcher: the first job stays
// queued until `run`, so the superseding submit's cancel lands first.
let (mut c, d) = new_cacher_slow();
c.attach(7);
c.attach(7).unwrap();
let first = c.single_frame(Rational::new(0, 1));
let second = c.single_frame(Rational::new(1, 1));
assert_ne!(first, second);
@@ -381,7 +381,7 @@ mod tests {
#[test]
fn ignore_requests_suppresses_jobs() {
let (mut c, d) = new_cacher();
c.attach(7);
c.attach(7).unwrap();
c.ignore_requests = true;
c.on_cache_request(7, TimeRange::new(Rational::new(0, 1), Rational::new(5, 1)));
assert!(c.live_jobs().is_empty());
@@ -391,7 +391,7 @@ mod tests {
#[test]
fn renders_paused_queues_but_does_not_start() {
let (mut c, d) = new_cacher();
c.attach(7);
c.attach(7).unwrap();
c.renders_paused = true;
c.on_cache_request(7, TimeRange::new(Rational::new(0, 1), Rational::new(5, 1)));
assert!(c.live_jobs().is_empty(), "paused: no jobs started");
@@ -402,7 +402,7 @@ mod tests {
#[test]
fn cancel_video_tasks_wait_blocks_until_idle() {
let (mut c, d) = new_cacher();
c.attach(7);
c.attach(7).unwrap();
c.force_range(TimeRange::new(Rational::new(0, 1), Rational::new(1, 1)));
assert!(c.is_rendering_custom_range() || c.live_jobs().len() == 1);
// Drain so the wait below observes every job finished.
@@ -452,7 +452,7 @@ mod tests {
#[test]
fn clear_finished_single_frames_removes_done() {
let (mut c, d) = new_cacher();
c.attach(7);
c.attach(7).unwrap();
let id = c.single_frame(Rational::new(0, 1));
d.run();
c.arena.wait(id).unwrap();
+9 -4
View File
@@ -40,11 +40,9 @@ use std::sync::{Arc, Mutex};
use crate::error::{Error, Result};
use crate::shaderfx::{compile_effect, run_effect};
use oak_codec::decoder::{
CodecStream, Decoder as _, RenderMode, RetrieveAudioStatus, RetrieveVideoParams,
K_COLOR_RANGE_DEFAULT,
CodecStream, RenderMode, RetrieveAudioStatus, RetrieveVideoParams, K_COLOR_RANGE_DEFAULT,
};
use oak_codec::ffmpeg::FFmpegDecoder;
use oak_core::color::ColorProcessor;
use oak_core::frame::VideoParamsPod;
use oak_core::texture::{Frame, Texture};
use oak_core::{PixelFormat, Rational, TimeRange};
@@ -287,6 +285,7 @@ fn purple_frame(time: Rational, size: (i32, i32)) -> Texture {
}
impl RenderEvalHooks {
/// A hook set with every optional hook unset (`use_cache` off).
pub fn new() -> Self {
Self {
use_cache: false,
@@ -346,6 +345,10 @@ impl RenderEvalHooks {
/// C++ process_frame_generation: fill the destination with a generated
/// F32 frame (transparent black for now).
///
/// Only the `generation_fills_cpu_texture` unit test drives this today;
/// the live eval path uses the shader/graph hooks instead.
#[allow(dead_code)]
fn process_frame_generation(
&mut self,
destination: &mut Texture,
@@ -3407,7 +3410,9 @@ mod tests {
}
}
let payload = ColorTransformJobPayload {
color_processor: std::sync::Arc::new(ColorProcessor::pass_through()),
color_processor: std::sync::Arc::new(
oak_core::color::ColorProcessor::pass_through(),
),
input: NodeValue::Texture(oak_node::handle::make_owned(Texture::wrap_frame(frame))),
time: Rational::new(0, 1),
};
+7 -7
View File
@@ -81,7 +81,7 @@ use crate::ipc::{
FrameSlotMeta, FrameSlotPool, HandshakeMsg, HelloCapsMsg, PluginProgressMsg, RenderAudioBatchMsg,
RenderBatchMsg, SharedMemoryRegion, ShmMode, WireMontageClip, SLOT_FORMAT_BGRA8,
TYPE_BATCH_ACCEPTED, TYPE_ERROR, TYPE_FRAME_FAILED, TYPE_FRAME_READY, TYPE_HANDSHAKE,
TYPE_HELLO_CAPS, TYPE_PLUGIN_CANCEL, TYPE_PLUGIN_PROGRESS, TYPE_RENDER_AUDIO_BATCH,
TYPE_HELLO_CAPS, TYPE_PLUGIN_PROGRESS, TYPE_RENDER_AUDIO_BATCH,
plugin_cancel_json,
};
use crate::scheduler::{FrameKey, FrameRequest, PreviewScheduler, SubmitOutcome};
@@ -901,7 +901,6 @@ enum WorkerEvent {
}
struct WorkerHandle {
index: usize,
/// Spawn generation (increments on every restart): reader-thread
/// events carry the generation of the child they read from, so a
/// late EOF from a dead child cannot kill its replacement.
@@ -941,14 +940,12 @@ struct WorkerHandle {
impl WorkerHandle {
fn shell(
index: usize,
generation: u64,
shm: Arc<ShmRegionView>,
slots: u32,
slot_bytes: usize,
) -> WorkerHandle {
WorkerHandle {
index,
generation,
state: WorkerState::Starting,
child: None,
@@ -1528,7 +1525,7 @@ impl ProcessDispatcher {
handle.retire_sent_at = Some(Instant::now());
}
let mut reaped_flags: Vec<bool> = Vec::with_capacity(inner.workers.len());
for (i, handle) in inner.workers.iter_mut().enumerate() {
for handle in inner.workers.iter_mut() {
if !handle.retiring {
reaped_flags.push(false);
continue;
@@ -2007,7 +2004,8 @@ impl ProcessDispatcher {
})
.map_err(|e| Error::Failed(format!("spawn reader thread: {e}")))?;
let mut handle = WorkerHandle::shell(index, generation, shm, inner.slots, inner.slot_bytes);
let mut handle =
WorkerHandle::shell(generation, shm, inner.slots, inner.slot_bytes);
handle.child = Some(child);
handle.stdin = stdin;
handle.spawned_at = Instant::now();
@@ -2749,7 +2747,9 @@ mod tests {
let mut inner = dispatcher.inner.lock().unwrap_or_else(|e| e.into_inner());
let key = SharedMemoryRegion::make_key(std::process::id() as i64, 999);
let shm = ShmRegionView::create(&key, 2, 256).expect("shm");
inner.workers.push(WorkerHandle::shell(0, 0, shm, 2, 256));
inner
.workers
.push(WorkerHandle::shell(0, shm, 2, 256));
}
let mut fired = Vec::new();
-2
View File
@@ -111,7 +111,6 @@ pub struct ClaimedBatch<P> {
struct Claim<P> {
worker: usize,
batch_id: u64,
request: FrameRequest<P>,
}
@@ -314,7 +313,6 @@ impl<P: Clone> PreviewScheduler<P> {
entry.request.key,
Claim {
worker,
batch_id,
request: entry.request.clone(),
},
);
+1 -1
View File
@@ -196,7 +196,7 @@ pub fn render(req: &TextLayoutRequest, transform: &TextRenderTransform, target:
}
let mut sys = lock_system();
let mut buffer = layout(&mut sys.font_system, req, &text);
let buffer = layout(&mut sys.font_system, req, &text);
let TextSystem {
font_system,
swash_cache,