Eliminate build warnings from the Scrap crate (#13383)

* Updated build.rs to tell RustC that dxgi, quartz and x11 are expected configurations.
Added lifetime annotations to various methods in common/aom.rs and common/vpxcodec.rs.
Updated common/vpx.rs to allow unused_imports in the generated bindings.
Updated dxgi/mag.rs to allow non_snake_case identifiers like "dwFilterMode".

* Added lifetime annotations to methods in common/hwcodec.rs and common/vram.rs.

* Switched syntax for the rustc-check-cfg directive emitted by build.rs in the scrap crate to use syntax compatible with Rust toolchain version 1.75. The double-colon syntax requires 1.77 or newer, but the older single-colon syntax works fine on newer versions for this directive.

* Update libs/scrap/build.rs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Revert apparently-erroneous AI suggestion. It's usually pretty good, but not always right it seems. :-)

This reverts commit bf862b13f6.

* Removed redundant configuration directives from libs/scrap/build.rs.

---------

Co-authored-by: RustDesk <71636191+rustdesk@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Jonathan Gilbert
2025-11-03 20:19:13 -06:00
committed by GitHub
parent b75f4daa47
commit a903f710ea
7 changed files with 15 additions and 24 deletions

View File

@@ -287,7 +287,7 @@ impl EncoderApi for AomEncoder {
}
impl AomEncoder {
pub fn encode(&mut self, ms: i64, data: &[u8], stride_align: usize) -> Result<EncodeFrames> {
pub fn encode<'a>(&'a mut self, ms: i64, data: &[u8], stride_align: usize) -> Result<EncodeFrames<'a>> {
let bpp = if self.i444 { 24 } else { 12 };
if data.len() < self.width * self.height * bpp / 8 {
return Err(Error::FailedCall("len not enough".to_string()));
@@ -461,7 +461,7 @@ impl AomDecoder {
Ok(Self { ctx })
}
pub fn decode(&mut self, data: &[u8]) -> Result<DecodeFrames> {
pub fn decode<'a>(&'a mut self, data: &[u8]) -> Result<DecodeFrames<'a>> {
call_aom!(aom_codec_decode(
&mut self.ctx,
data.as_ptr(),
@@ -476,7 +476,7 @@ impl AomDecoder {
}
/// Notify the decoder to return any pending frame
pub fn flush(&mut self) -> Result<DecodeFrames> {
pub fn flush<'a>(&'a mut self) -> Result<DecodeFrames<'a>> {
call_aom!(aom_codec_decode(
&mut self.ctx,
ptr::null(),

View File

@@ -364,7 +364,7 @@ impl HwRamDecoder {
}
}
}
pub fn decode(&mut self, data: &[u8]) -> ResultType<Vec<HwRamDecoderImage>> {
pub fn decode<'a>(&'a mut self, data: &[u8]) -> ResultType<Vec<HwRamDecoderImage<'a>>> {
match self.decoder.decode(data) {
Ok(v) => Ok(v.iter().map(|f| HwRamDecoderImage { frame: f }).collect()),
Err(e) => Err(anyhow!(e)),

View File

@@ -3,6 +3,7 @@
#![allow(non_upper_case_globals)]
#![allow(improper_ctypes)]
#![allow(dead_code)]
#![allow(unused_imports)]
impl Default for vpx_codec_enc_cfg {
fn default() -> Self {

View File

@@ -231,7 +231,7 @@ impl EncoderApi for VpxEncoder {
}
impl VpxEncoder {
pub fn encode(&mut self, pts: i64, data: &[u8], stride_align: usize) -> Result<EncodeFrames> {
pub fn encode<'a>(&'a mut self, pts: i64, data: &[u8], stride_align: usize) -> Result<EncodeFrames<'a>> {
let bpp = if self.i444 { 24 } else { 12 };
if data.len() < self.width * self.height * bpp / 8 {
return Err(Error::FailedCall("len not enough".to_string()));
@@ -268,7 +268,7 @@ impl VpxEncoder {
}
/// Notify the encoder to return any pending packets
pub fn flush(&mut self) -> Result<EncodeFrames> {
pub fn flush<'a>(&'a mut self) -> Result<EncodeFrames<'a>> {
call_vpx!(vpx_codec_encode(
&mut self.ctx,
ptr::null(),
@@ -473,7 +473,7 @@ impl VpxDecoder {
/// The `data` slice is sent to the decoder
///
/// It matches a call to `vpx_codec_decode`.
pub fn decode(&mut self, data: &[u8]) -> Result<DecodeFrames> {
pub fn decode<'a>(&'a mut self, data: &[u8]) -> Result<DecodeFrames<'a>> {
call_vpx!(vpx_codec_decode(
&mut self.ctx,
data.as_ptr(),
@@ -489,7 +489,7 @@ impl VpxDecoder {
}
/// Notify the decoder to return any pending frame
pub fn flush(&mut self) -> Result<DecodeFrames> {
pub fn flush<'a>(&'a mut self) -> Result<DecodeFrames<'a>> {
call_vpx!(vpx_codec_decode(
&mut self.ctx,
ptr::null(),

View File

@@ -367,7 +367,7 @@ impl VRamDecoder {
}
}
}
pub fn decode(&mut self, data: &[u8]) -> ResultType<Vec<VRamDecoderImage>> {
pub fn decode<'a>(&'a mut self, data: &[u8]) -> ResultType<Vec<VRamDecoderImage<'a>>> {
match self.decoder.decode(data) {
Ok(v) => Ok(v.iter().map(|f| VRamDecoderImage { frame: f }).collect()),
Err(e) => Err(anyhow!(e)),