diff --git a/core/src/lib.rs b/core/src/lib.rs index 3ff964d29..6874f8ee8 100644 --- a/core/src/lib.rs +++ b/core/src/lib.rs @@ -1,5 +1,8 @@ // This is a new lint with false positives, see https://github.com/rust-lang/rust-clippy/issues/10318 #![allow(clippy::extra_unused_type_parameters)] +// This lint is helpful, but right now we have too many instances of it. +// TODO: Remove this once all instances are fixed. +#![allow(clippy::needless_pass_by_ref_mut)] #[macro_use] mod display_object; diff --git a/core/src/timer.rs b/core/src/timer.rs index a2413d42c..91655a2a8 100644 --- a/core/src/timer.rs +++ b/core/src/timer.rs @@ -313,9 +313,7 @@ impl Eq for Timer<'_> {} impl PartialOrd for Timer<'_> { fn partial_cmp(&self, other: &Self) -> Option { - self.tick_time - .partial_cmp(&other.tick_time) - .map(|o| o.reverse()) + Some(self.cmp(other)) } } diff --git a/render/wgpu/src/lib.rs b/render/wgpu/src/lib.rs index 7b644ef87..03d476041 100644 --- a/render/wgpu/src/lib.rs +++ b/render/wgpu/src/lib.rs @@ -2,6 +2,9 @@ #![allow(clippy::extra_unused_type_parameters)] // Remove this when we decide on how to handle multithreaded rendering (especially on wasm) #![allow(clippy::arc_with_non_send_sync)] +// This lint is helpful, but right now we have too many instances of it. +// TODO: Remove this once all instances are fixed. +#![allow(clippy::needless_pass_by_ref_mut)] use crate::bitmaps::BitmapSamplers; use crate::buffer_pool::{BufferPool, PoolEntry}; diff --git a/tests/tests/external_interface/mod.rs b/tests/tests/external_interface/mod.rs index cf6f17f4f..1d81d1720 100644 --- a/tests/tests/external_interface/mod.rs +++ b/tests/tests/external_interface/mod.rs @@ -1,3 +1,7 @@ +// This lint is helpful, but right now we have too many instances of it. +// TODO: Remove this once all instances are fixed. +#![allow(clippy::needless_pass_by_ref_mut)] + use ruffle_core::context::UpdateContext; use ruffle_core::external::Value as ExternalValue; use ruffle_core::external::{ExternalInterfaceMethod, ExternalInterfaceProvider}; diff --git a/wstr/src/common.rs b/wstr/src/common.rs index 358cc45e1..d9a5aed4e 100644 --- a/wstr/src/common.rs +++ b/wstr/src/common.rs @@ -485,7 +485,7 @@ impl> IndexMut for WStr { } } -impl core::cmp::PartialEq for WStr { +impl core::cmp::PartialEq for WStr { #[inline] fn eq(&self, other: &WStr) -> bool { super::ops::str_eq(self, other) @@ -501,6 +501,13 @@ impl core::cmp::Ord for WStr { } } +impl core::cmp::PartialOrd for WStr { + #[inline] + fn partial_cmp(&self, other: &Self) -> Option { + Some(self.cmp(other)) + } +} + impl core::hash::Hash for WStr { #[inline] fn hash(&self, state: &mut H) { @@ -582,13 +589,6 @@ macro_rules! __wstr_impl_internal { }; (@eq_ord_self [$($generics:tt)*] for $ty:ty) => { - impl<$($generics)*> ::core::cmp::PartialOrd<$ty> for $ty { - #[inline] - fn partial_cmp(&self, other: &$ty) -> Option<::core::cmp::Ordering> { - Some(::core::cmp::Ord::cmp(self, other)) - } - } - $crate::__wstr_impl_internal! { @eq_ord_units [$($generics)* const N: usize] for $ty, [u8; N] } $crate::__wstr_impl_internal! { @eq_ord_units [$($generics)* const N: usize] for $ty, [u16; N] } $crate::__wstr_impl_internal! { @eq_ord_units [$($generics)*] for $ty, [u8] } @@ -621,6 +621,7 @@ macro_rules! __wstr_impl_internal { } } + #[automatically_derived] impl<$($generics)*> ::core::cmp::Ord for $ty { #[inline] fn cmp(&self, other: &Self) -> ::core::cmp::Ordering { @@ -628,6 +629,14 @@ macro_rules! __wstr_impl_internal { } } + #[automatically_derived] + impl<$($generics)*> ::core::cmp::PartialOrd<$ty> for $ty { + #[inline] + fn partial_cmp(&self, other: &$ty) -> Option<::core::cmp::Ordering> { + Some(::core::cmp::Ord::cmp(::core::ops::Deref::deref(self), other)) + } + } + impl<$($generics)*> ::core::hash::Hash for $ty { #[inline] fn hash(&self, state: &mut H) {