chore: Appease beta Clippy

This commit is contained in:
sleepycatcoding 2023-08-22 15:42:18 +03:00 committed by Nathan Adams
parent 3de4b4e989
commit 34295f25ff
3 changed files with 8 additions and 6 deletions

View File

@ -205,7 +205,7 @@ impl<'gc> DispatchList<'gc> {
&mut self, &mut self,
event: impl Into<AvmString<'gc>>, event: impl Into<AvmString<'gc>>,
) -> &mut BTreeMap<i32, Vec<EventHandler<'gc>>> { ) -> &mut BTreeMap<i32, Vec<EventHandler<'gc>>> {
self.0.entry(event.into()).or_insert_with(BTreeMap::new) self.0.entry(event.into()).or_default()
} }
/// Get a single priority level of event handlers for a given event type, /// Get a single priority level of event handlers for a given event type,
@ -217,9 +217,9 @@ impl<'gc> DispatchList<'gc> {
) -> &mut Vec<EventHandler<'gc>> { ) -> &mut Vec<EventHandler<'gc>> {
self.0 self.0
.entry(event.into()) .entry(event.into())
.or_insert_with(BTreeMap::new) .or_default()
.entry(priority) .entry(priority)
.or_insert_with(Vec::new) .or_default()
} }
/// Add an event handler to this dispatch list. /// Add an event handler to this dispatch list.

View File

@ -421,6 +421,8 @@ impl<'gc> Library<'gc> {
} }
pub fn library_for_movie_mut(&mut self, movie: Arc<SwfMovie>) -> &mut MovieLibrary<'gc> { pub fn library_for_movie_mut(&mut self, movie: Arc<SwfMovie>) -> &mut MovieLibrary<'gc> {
// NOTE(Clippy): Cannot use or_default() here as PtrWeakKeyHashMap does not have such a method on its Entry API
#[allow(clippy::unwrap_or_default)]
self.movie_libraries self.movie_libraries
.entry(movie) .entry(movie)
.or_insert_with(MovieLibrary::new) .or_insert_with(MovieLibrary::new)

View File

@ -147,9 +147,9 @@ impl PixelBenderTypeExt for PixelBenderType {
PixelBenderType::TFloat2(f1, f2) => vec![cv(f1), cv(f2)], PixelBenderType::TFloat2(f1, f2) => vec![cv(f1), cv(f2)],
PixelBenderType::TFloat3(f1, f2, f3) => vec![cv(f1), cv(f2), cv(f3)], PixelBenderType::TFloat3(f1, f2, f3) => vec![cv(f1), cv(f2), cv(f3)],
PixelBenderType::TFloat4(f1, f2, f3, f4) => vec![cv(f1), cv(f2), cv(f3), cv(f4)], PixelBenderType::TFloat4(f1, f2, f3, f4) => vec![cv(f1), cv(f2), cv(f3), cv(f4)],
PixelBenderType::TFloat2x2(floats) => floats.iter().map(|f| cv(f)).collect(), PixelBenderType::TFloat2x2(floats) => floats.iter().map(cv).collect(),
PixelBenderType::TFloat3x3(floats) => floats.iter().map(|f| cv(f)).collect(), PixelBenderType::TFloat3x3(floats) => floats.iter().map(cv).collect(),
PixelBenderType::TFloat4x4(floats) => floats.iter().map(|f| cv(f)).collect(), PixelBenderType::TFloat4x4(floats) => floats.iter().map(cv).collect(),
PixelBenderType::TInt2(i1, i2) => vec![(*i1).into(), (*i2).into()], PixelBenderType::TInt2(i1, i2) => vec![(*i1).into(), (*i2).into()],
PixelBenderType::TInt3(i1, i2, i3) => vec![(*i1).into(), (*i2).into(), (*i3).into()], PixelBenderType::TInt3(i1, i2, i3) => vec![(*i1).into(), (*i2).into(), (*i3).into()],
PixelBenderType::TInt4(i1, i2, i3, i4) => { PixelBenderType::TInt4(i1, i2, i3, i4) => {