core: Fix nightly clippy lints

This commit is contained in:
Aaron Hill 2023-05-26 16:24:42 -05:00
parent 6d76e9669c
commit 9fad8ddd9d
6 changed files with 11 additions and 12 deletions

View File

@ -139,7 +139,7 @@ fn set_rgb<'gc>(
let [b, g, r, _] = rgb.to_le_bytes(); let [b, g, r, _] = rgb.to_le_bytes();
let mut base = target.base_mut(activation.context.gc_context); let mut base = target.base_mut(activation.context.gc_context);
let mut color_transform = base.color_transform_mut(); let color_transform = base.color_transform_mut();
color_transform.r_multiply = Fixed8::ZERO; color_transform.r_multiply = Fixed8::ZERO;
color_transform.g_multiply = Fixed8::ZERO; color_transform.g_multiply = Fixed8::ZERO;
color_transform.b_multiply = Fixed8::ZERO; color_transform.b_multiply = Fixed8::ZERO;

View File

@ -21,7 +21,7 @@ use thiserror::Error;
#[derive(Debug, Error)] #[derive(Debug, Error)]
pub enum Error { pub enum Error {
#[cfg(all(feature = "mp3"))] #[cfg(feature = "mp3")]
#[error("Couldn't decode MP3")] #[error("Couldn't decode MP3")]
InvalidMp3(#[from] mp3::Error), InvalidMp3(#[from] mp3::Error),

View File

@ -282,7 +282,7 @@ impl<'gc> DisplayObjectBase<'gc> {
let sin_x = f64::sin(degrees.into_radians()); let sin_x = f64::sin(degrees.into_radians());
let cos_y = f64::cos(degrees.into_radians() + self.skew); let cos_y = f64::cos(degrees.into_radians() + self.skew);
let sin_y = f64::sin(degrees.into_radians() + self.skew); let sin_y = f64::sin(degrees.into_radians() + self.skew);
let mut matrix = &mut self.transform.matrix; let matrix = &mut self.transform.matrix;
matrix.a = (self.scale_x.unit() * cos_x) as f32; matrix.a = (self.scale_x.unit() * cos_x) as f32;
matrix.b = (self.scale_x.unit() * sin_x) as f32; matrix.b = (self.scale_x.unit() * sin_x) as f32;
matrix.c = (self.scale_y.unit() * -sin_y) as f32; matrix.c = (self.scale_y.unit() * -sin_y) as f32;
@ -308,7 +308,7 @@ impl<'gc> DisplayObjectBase<'gc> {
let cos = f64::cos(self.rotation.into_radians()); let cos = f64::cos(self.rotation.into_radians());
let sin = f64::sin(self.rotation.into_radians()); let sin = f64::sin(self.rotation.into_radians());
let mut matrix = &mut self.transform.matrix; let matrix = &mut self.transform.matrix;
matrix.a = (cos * value.unit()) as f32; matrix.a = (cos * value.unit()) as f32;
matrix.b = (sin * value.unit()) as f32; matrix.b = (sin * value.unit()) as f32;
} }
@ -332,7 +332,7 @@ impl<'gc> DisplayObjectBase<'gc> {
let cos = f64::cos(self.rotation.into_radians() + self.skew); let cos = f64::cos(self.rotation.into_radians() + self.skew);
let sin = f64::sin(self.rotation.into_radians() + self.skew); let sin = f64::sin(self.rotation.into_radians() + self.skew);
let mut matrix = &mut self.transform.matrix; let matrix = &mut self.transform.matrix;
matrix.c = (-sin * value.unit()) as f32; matrix.c = (-sin * value.unit()) as f32;
matrix.d = (cos * value.unit()) as f32; matrix.d = (cos * value.unit()) as f32;
} }

View File

@ -848,7 +848,7 @@ impl<'gc> ChildContainer<'gc> {
.unwrap(); .unwrap();
self.render_list.remove(old_position); self.render_list.remove(old_position);
if let Some((_, below_child)) = self.depth_list.range(..depth).rev().next() { if let Some((_, below_child)) = self.depth_list.range(..depth).next_back() {
let new_position = self let new_position = self
.render_list .render_list
.iter() .iter()

View File

@ -320,7 +320,7 @@ impl<'gc> EditText<'gc> {
// Set position. // Set position.
{ {
let mut base = text_field.base_mut(context.gc_context); let mut base = text_field.base_mut(context.gc_context);
let mut matrix = base.matrix_mut(); let matrix = base.matrix_mut();
matrix.tx = Twips::from_pixels(x); matrix.tx = Twips::from_pixels(x);
matrix.ty = Twips::from_pixels(y); matrix.ty = Twips::from_pixels(y);
} }

View File

@ -18,7 +18,7 @@ use ruffle_render::quality::StageQuality;
use ruffle_video::error::Error; use ruffle_video::error::Error;
use ruffle_video::frame::EncodedFrame; use ruffle_video::frame::EncodedFrame;
use ruffle_video::VideoStreamHandle; use ruffle_video::VideoStreamHandle;
use std::borrow::{Borrow, BorrowMut}; use std::borrow::BorrowMut;
use std::cell::{Ref, RefMut}; use std::cell::{Ref, RefMut};
use std::collections::{BTreeMap, BTreeSet}; use std::collections::{BTreeMap, BTreeSet};
use std::sync::Arc; use std::sync::Arc;
@ -242,8 +242,7 @@ impl<'gc> Video<'gc> {
let prev_keyframe_id = read let prev_keyframe_id = read
.keyframes .keyframes
.range(..=frame_id) .range(..=frame_id)
.rev() .next_back()
.next()
.copied() .copied()
.unwrap_or(0); .unwrap_or(0);
@ -458,14 +457,14 @@ impl<'gc> TDisplayObject<'gc> for Video<'gc> {
} }
fn id(&self) -> CharacterId { fn id(&self) -> CharacterId {
match (*self.0.read().source.read()).borrow() { match &*self.0.read().source.read() {
VideoSource::Swf { streamdef, .. } => streamdef.id, VideoSource::Swf { streamdef, .. } => streamdef.id,
VideoSource::NetStream { .. } => 0, VideoSource::NetStream { .. } => 0,
} }
} }
fn self_bounds(&self) -> Rectangle<Twips> { fn self_bounds(&self) -> Rectangle<Twips> {
match (*self.0.read().source.read()).borrow() { match &*self.0.read().source.read() {
VideoSource::Swf { streamdef, .. } => Rectangle { VideoSource::Swf { streamdef, .. } => Rectangle {
x_min: Twips::ZERO, x_min: Twips::ZERO,
y_min: Twips::ZERO, y_min: Twips::ZERO,