diff --git a/core/src/avm1/globals/math.rs b/core/src/avm1/globals/math.rs index e94fbd770..6bdc4c5da 100644 --- a/core/src/avm1/globals/math.rs +++ b/core/src/avm1/globals/math.rs @@ -82,8 +82,8 @@ pub fn create<'gc>(gc_context: MutationContext<'gc, '_>) -> GcCell<'gc, Object<' #[cfg(test)] mod tests { use super::*; - use crate::avm1::Error; use crate::avm1::activation::Activation; + use crate::avm1::Error; use crate::backend::audio::NullAudioBackend; use crate::backend::navigator::NullNavigatorBackend; use crate::display_object::DisplayObject; diff --git a/core/src/avm1/object.rs b/core/src/avm1/object.rs index db1a90beb..91ce7be50 100644 --- a/core/src/avm1/object.rs +++ b/core/src/avm1/object.rs @@ -1,6 +1,6 @@ -use crate::avm1::{ActionContext, Avm1, Value}; -use crate::avm1::function::{Executable, NativeFunction, Avm1Function, Avm1Function2}; +use crate::avm1::function::{Avm1Function, Avm1Function2, Executable, NativeFunction}; use crate::avm1::scope::Scope; +use crate::avm1::{ActionContext, Avm1, Value}; use crate::display_object::DisplayNode; use crate::tag_utils::SwfSlice; use core::fmt; @@ -135,7 +135,7 @@ impl<'gc> Object<'gc> { } /// Constructs an object with no values, not even builtins. - /// + /// /// Intended for constructing scope chains, since they exclusively use the /// object values, but can't just have a hashmap because of `with` and /// friends. @@ -157,12 +157,24 @@ impl<'gc> Object<'gc> { } } - pub fn action_function(swf_version: u8, actions: SwfSlice, name: &str, params: &[&str], scope: GcCell<'gc, Scope<'gc>>) -> Self { + pub fn action_function( + swf_version: u8, + actions: SwfSlice, + name: &str, + params: &[&str], + scope: GcCell<'gc, Scope<'gc>>, + ) -> Self { Self { type_of: TYPE_OF_FUNCTION, - function: Some(Executable::Action(Avm1Function::new(swf_version, actions, name, params, scope))), + function: Some(Executable::Action(Avm1Function::new( + swf_version, + actions, + name, + params, + scope, + ))), display_node: None, - values: HashMap::new() + values: HashMap::new(), } } @@ -171,7 +183,7 @@ impl<'gc> Object<'gc> { type_of: TYPE_OF_FUNCTION, function: Some(Executable::Action2(func)), display_node: None, - values: HashMap::new() + values: HashMap::new(), } } @@ -244,7 +256,10 @@ impl<'gc> Object<'gc> { ) { self.force_set( name, - Value::Object(GcCell::allocate(gc_context, Object::native_function(function))), + Value::Object(GcCell::allocate( + gc_context, + Object::native_function(function), + )), ) } @@ -283,10 +298,10 @@ impl<'gc> Object<'gc> { self.values.contains_key(name) } - pub fn iter_values(&self) -> impl Iterator)> { + pub fn iter_values(&self) -> impl Iterator)> { self.values.iter().filter_map(|(k, p)| match p { - Property::Virtual {..} => None, - Property::Stored { value, .. } => Some((k, value)) + Property::Virtual { .. } => None, + Property::Stored { value, .. } => Some((k, value)), }) } @@ -325,11 +340,11 @@ impl<'gc> Object<'gc> { mod tests { use super::*; + use crate::avm1::activation::Activation; use crate::backend::audio::NullAudioBackend; use crate::backend::navigator::NullNavigatorBackend; use crate::display_object::DisplayObject; use crate::movie_clip::MovieClip; - use crate::avm1::activation::Activation; use gc_arena::rootless_arena; use rand::{rngs::SmallRng, SeedableRng}; diff --git a/core/src/player.rs b/core/src/player.rs index c0a9171f2..b1f004e2e 100644 --- a/core/src/player.rs +++ b/core/src/player.rs @@ -515,7 +515,11 @@ impl action_context.start_clip = active_clip; action_context.active_clip = active_clip; action_context.target_clip = Some(active_clip); - update_context.avm.insert_stack_frame_for_action(update_context.swf_version, action, &mut action_context); + update_context.avm.insert_stack_frame_for_action( + update_context.swf_version, + action, + &mut action_context, + ); let _ = update_context.avm.run_stack_till_empty(&mut action_context); } } diff --git a/core/src/tag_utils.rs b/core/src/tag_utils.rs index 877be9ec0..5e43631dc 100644 --- a/core/src/tag_utils.rs +++ b/core/src/tag_utils.rs @@ -19,7 +19,7 @@ impl AsRef<[u8]> for SwfSlice { impl SwfSlice { /// Construct a new SwfSlice from a regular slice. - /// + /// /// This function returns None if the given slice is not a subslice of the /// current slice. pub fn to_subslice(&self, slice: &[u8]) -> Option { @@ -30,7 +30,7 @@ impl SwfSlice { Some(SwfSlice { data: self.data.clone(), start: slice_pval - self_pval, - end: (slice_pval - self_pval) + slice.len() + end: (slice_pval - self_pval) + slice.len(), }) } else { None