Skip to content

Commit 233e98a

Browse files
authored
Fix warnings from newer toolchain versions (#1446)
This resolves a couple of new warnings that appear when building with newer nightly toolchains. These warnings don't show up with the toolchain version specified in `rust-toolchain.toml`, but the fixes are fully compatible with it. These changes are purely cosmetic and result in an identical compiled binary. ## Fix mismatched_lifetime_syntaxes warning The first change addresses the `mismatched_lifetime_syntaxes` lint that became enabled by default in nightly [1.89](rust-lang/rust#138677) - this lint suggests making elided lifetimes in return types explicit to avoid ambiguity. ## Fix function pointer comparison warning The second change silences a warning about deriving `PartialEq` and `Eq` for the function wrapper `Fn(FnPtr)`, as the address of a given function is not guaranteed to be unique across codegen units. This was caused by `Fn(FnPtr)` deriving `PartialEq` and `Eq` in the wrap_fn_ptr! macro. Since these traits don't appear to be used anywhere in the project, removing them resolves the warning. If the Actions tests prove this change wrong I'll revert it.
2 parents ab750d8 + 7db4c09 commit 233e98a

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/cdf.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ impl CdfThreadContext {
145145
}
146146
}
147147

148-
pub fn cdf_write(&self) -> RwLockWriteGuard<CdfContext> {
148+
pub fn cdf_write(&self) -> RwLockWriteGuard<'_, CdfContext> {
149149
match self {
150150
Self::QCat(_) => panic!("Expected a Cdf"),
151151
Self::Cdf(cdf) => cdf.cdf.try_write().unwrap(),

src/include/dav1d/picture.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ impl Rav1dPictureDataComponent {
248248
BD::pxstride(self.byte_len() - (-stride) as usize)
249249
}
250250

251-
pub fn with_offset<BD: BitDepth>(&self) -> Rav1dPictureDataComponentOffset {
251+
pub fn with_offset<BD: BitDepth>(&self) -> Rav1dPictureDataComponentOffset<'_> {
252252
Rav1dPictureDataComponentOffset {
253253
data: self,
254254
offset: self.pixel_offset::<BD>(),
@@ -521,7 +521,7 @@ impl From<Rav1dPicture> for Dav1dPicture {
521521
}
522522

523523
impl Rav1dPicture {
524-
pub fn lf_offsets<BD: BitDepth>(&self, y: c_int) -> [Rav1dPictureDataComponentOffset; 3] {
524+
pub fn lf_offsets<BD: BitDepth>(&self, y: c_int) -> [Rav1dPictureDataComponentOffset<'_>; 3] {
525525
// Init loopfilter offsets. Point the chroma offsets in 4:0:0 to the luma
526526
// plane here to avoid having additional in-loop branches in various places.
527527
// We never use those values, so it doesn't really matter what they point

src/wrap_fn_ptr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ macro_rules! wrap_fn_ptr {
5353
/// This allows us to add a safer
5454
/// (type-safe for sure, and increasingly fully safe)
5555
/// interface for calling a `fn` ptr.
56-
#[derive(Clone, Copy, PartialEq, Eq)]
56+
#[derive(Clone, Copy)]
5757
#[repr(transparent)]
5858
pub struct Fn(FnPtr);
5959

0 commit comments

Comments
 (0)