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:
@@ -250,7 +250,7 @@ impl CodecStream {
|
||||
|
||||
/// Associated timeline block (borrowed; only compared, never used).
|
||||
pub fn block(&self) -> Option<OakNodeBlock> {
|
||||
self.block.clone()
|
||||
self.block
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -558,7 +558,7 @@ impl<'a> Cursor<'a> {
|
||||
}
|
||||
|
||||
fn skip_ws(&mut self) {
|
||||
while self.peek().map_or(false, char::is_whitespace) {
|
||||
while self.peek().is_some_and(char::is_whitespace) {
|
||||
self.i += 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1178,12 +1178,12 @@ impl DecoderState {
|
||||
ctx.run(&f, &mut out).map_err(ffmpeg_err)?;
|
||||
let bytes = if f32_ok {
|
||||
let stride = out.stride(0);
|
||||
convert_rgba_f32_le(&out.data(0), w, h, stride)
|
||||
convert_rgba_f32_le(out.data(0), w, h, stride)
|
||||
} else if out_fmt == Pixel::YUV444P16LE {
|
||||
convert_yuv444p16_to_rgba_f32(&out, w, h, yuv_matrix_for(raw_space, src_w, src_h), full_range)
|
||||
} else {
|
||||
let stride = out.stride(0);
|
||||
convert_rgba8_to_f32(&out.data(0), w, h, stride)
|
||||
convert_rgba8_to_f32(out.data(0), w, h, stride)
|
||||
};
|
||||
let meta = crate::decoder::DecodedColorMeta {
|
||||
color_primaries: raw_primaries,
|
||||
@@ -2084,9 +2084,9 @@ fn probe_file(filename: &str, cancelled: Option<&CancelAtom>) -> Option<FootageD
|
||||
vp.set_channel_count(VIDEO_CHANNELS);
|
||||
vp.set_interlacing(Interlacing::None);
|
||||
vp.set_pixel_aspect_ratio(1, 1);
|
||||
vp.set_frame_rate(frame_rate.0 as i32, frame_rate.1 as i32);
|
||||
vp.set_frame_rate(frame_rate.0, frame_rate.1);
|
||||
vp.set_start_time(stream.start_time());
|
||||
vp.set_time_base(tb.0 as i32, tb.1 as i32);
|
||||
vp.set_time_base(tb.0, tb.1);
|
||||
vp.set_duration(stream.duration());
|
||||
vp.set_premultiplied_alpha(false);
|
||||
// Stream colorimetry (drives the input→working transform
|
||||
@@ -2134,7 +2134,7 @@ fn probe_file(filename: &str, cancelled: Option<&CancelAtom>) -> Option<FootageD
|
||||
format: 0,
|
||||
stream_index: i as i32,
|
||||
duration: stream_duration,
|
||||
time_base: (tb.0 as i32, tb.1 as i32),
|
||||
time_base: (tb.0, tb.1),
|
||||
}));
|
||||
}
|
||||
_ => {}
|
||||
|
||||
@@ -243,7 +243,7 @@ mod tests {
|
||||
assert!(!d.is_open());
|
||||
|
||||
// Already open -> refuse.
|
||||
assert!(d.open(&[ok.clone()], OpenMode::WriteOnly));
|
||||
assert!(d.open(std::slice::from_ref(&ok), OpenMode::WriteOnly));
|
||||
assert!(!d.open(&[ok], OpenMode::WriteOnly));
|
||||
}
|
||||
|
||||
|
||||
@@ -317,11 +317,10 @@ impl ProxyManager {
|
||||
/// Locate an ffmpeg executable (empty string when none found).
|
||||
pub fn find_ffmpeg(configured_path: &str) -> String {
|
||||
// An explicitly configured path takes precedence if it is usable.
|
||||
if !configured_path.is_empty() {
|
||||
if is_executable_file(Path::new(configured_path)) {
|
||||
if !configured_path.is_empty()
|
||||
&& is_executable_file(Path::new(configured_path)) {
|
||||
return absolute(configured_path);
|
||||
}
|
||||
}
|
||||
|
||||
// Fall back to searching the system PATH (split per platform:
|
||||
// `;` on Windows, `:` elsewhere — see [`split_path_env`]).
|
||||
|
||||
@@ -335,8 +335,8 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn task_kind_values_match_abi() {
|
||||
assert_eq!(TaskKind::Conform as i32, OAKCODEC_TASK_CONFORM as i32);
|
||||
assert_eq!(TaskKind::Proxy as i32, OAKCODEC_TASK_PROXY as i32);
|
||||
assert_eq!(TaskKind::Conform as i32, OAKCODEC_TASK_CONFORM);
|
||||
assert_eq!(TaskKind::Proxy as i32, OAKCODEC_TASK_PROXY);
|
||||
}
|
||||
|
||||
// ABI constants mirrored from include/codec/task.h.
|
||||
|
||||
@@ -66,7 +66,7 @@ fn frame_rate(timebase: &Rational) -> f64 {
|
||||
/// `drop_frame` is true when the (already trimmed) string contains a `;`.
|
||||
/// Returns `None` on any parse failure.
|
||||
fn timecode_to_time(timecode: &str, timebase: &Rational, drop_frame: bool) -> Option<Rational> {
|
||||
let mut tokens: Vec<&str> = timecode.split(|c| c == ':' || c == ';').collect();
|
||||
let mut tokens: Vec<&str> = timecode.split([':', ';']).collect();
|
||||
let element_count = 4;
|
||||
|
||||
// Keep only the leading `HH:MM:SS:FF` tokens.
|
||||
|
||||
Reference in New Issue
Block a user