core: Update formatting with latest nightly 'cargo fmt'
This commit is contained in:
parent
0fe8469d24
commit
f7c50865a0
|
@ -1334,7 +1334,9 @@ fn compare<'gc>(
|
|||
const DIFFERENT_WIDTHS: i32 = -3;
|
||||
const DIFFERENT_HEIGHTS: i32 = -4;
|
||||
|
||||
let NativeObject::BitmapData(this_bitmap_data) = this.native() else { return Ok(NOT_BITMAP.into()); };
|
||||
let NativeObject::BitmapData(this_bitmap_data) = this.native() else {
|
||||
return Ok(NOT_BITMAP.into());
|
||||
};
|
||||
|
||||
if this_bitmap_data.disposed() {
|
||||
// The documentation says that -2 should be returned here, but -1 is actually returned.
|
||||
|
@ -1394,7 +1396,9 @@ fn load_bitmap<'gc>(
|
|||
.library_for_movie(movie)
|
||||
.and_then(|l| l.character_by_export_name(name));
|
||||
|
||||
let Some(Character::Bitmap(bitmap)) = character else { return Ok(Value::Undefined); };
|
||||
let Some(Character::Bitmap(bitmap)) = character else {
|
||||
return Ok(Value::Undefined);
|
||||
};
|
||||
|
||||
let transparency = true;
|
||||
let bitmap_data = BitmapData::new_with_pixels(
|
||||
|
|
|
@ -78,10 +78,10 @@ fn method<'gc>(
|
|||
}
|
||||
|
||||
let NativeObject::Transform(this) = this.native() else {
|
||||
return Ok(Value::Undefined)
|
||||
return Ok(Value::Undefined);
|
||||
};
|
||||
let Some(clip) = this.clip(activation) else {
|
||||
return Ok(Value::Undefined)
|
||||
return Ok(Value::Undefined);
|
||||
};
|
||||
|
||||
Ok(match index {
|
||||
|
|
|
@ -278,7 +278,7 @@ pub fn describe_type<'gc>(
|
|||
.classes()
|
||||
.xml
|
||||
.construct(activation, &[])?
|
||||
.into())
|
||||
.into());
|
||||
};
|
||||
let mut xml_string = String::new();
|
||||
|
||||
|
|
|
@ -160,7 +160,8 @@ impl<'gc> ScriptObjectData<'gc> {
|
|||
));
|
||||
}
|
||||
|
||||
let Some(local_name) = multiname.local_name() else { // when can this happen?
|
||||
let Some(local_name) = multiname.local_name() else {
|
||||
// when can this happen?
|
||||
return Err(error::make_reference_error(
|
||||
activation,
|
||||
error::ReferenceErrorCode::InvalidRead,
|
||||
|
|
|
@ -327,9 +327,7 @@ impl<'gc> TObject<'gc> for XmlObject<'gc> {
|
|||
|
||||
let write = self.0.write(mc);
|
||||
let mut kind = write.node.kind_mut(mc);
|
||||
let E4XNodeKind::Element {
|
||||
attributes, ..
|
||||
} = &mut *kind else {
|
||||
let E4XNodeKind::Element { attributes, .. } = &mut *kind else {
|
||||
return Ok(());
|
||||
};
|
||||
|
||||
|
@ -340,9 +338,7 @@ impl<'gc> TObject<'gc> for XmlObject<'gc> {
|
|||
let self_node = *self.node();
|
||||
let write = self.0.write(mc);
|
||||
let mut kind = write.node.kind_mut(mc);
|
||||
let E4XNodeKind::Element {
|
||||
children, ..
|
||||
} = &mut *kind else {
|
||||
let E4XNodeKind::Element { children, .. } = &mut *kind else {
|
||||
return Ok(());
|
||||
};
|
||||
|
||||
|
@ -399,8 +395,10 @@ impl<'gc> TObject<'gc> for XmlObject<'gc> {
|
|||
let mut kind = write.node.kind_mut(mc);
|
||||
let E4XNodeKind::Element {
|
||||
children,
|
||||
attributes,..
|
||||
} = &mut *kind else {
|
||||
attributes,
|
||||
..
|
||||
} = &mut *kind
|
||||
else {
|
||||
return Ok(false);
|
||||
};
|
||||
|
||||
|
|
|
@ -1137,7 +1137,9 @@ impl<'gc> EditText<'gc> {
|
|||
|
||||
pub fn screen_position_to_index(self, position: Point<Twips>) -> Option<usize> {
|
||||
let text = self.0.read();
|
||||
let Some(mut position) = self.global_to_local(position) else { return None; };
|
||||
let Some(mut position) = self.global_to_local(position) else {
|
||||
return None;
|
||||
};
|
||||
position.x += Twips::from_pixels(Self::INTERNAL_PADDING);
|
||||
position.y += Twips::from_pixels(Self::INTERNAL_PADDING);
|
||||
|
||||
|
|
|
@ -205,7 +205,9 @@ impl<'gc> TDisplayObject<'gc> for Graphic<'gc> {
|
|||
if (!options.contains(HitTestOptions::SKIP_INVISIBLE) || self.visible())
|
||||
&& self.world_bounds().contains(point)
|
||||
{
|
||||
let Some(local_matrix) = self.global_to_local_matrix() else { return false; };
|
||||
let Some(local_matrix) = self.global_to_local_matrix() else {
|
||||
return false;
|
||||
};
|
||||
let point = local_matrix * point;
|
||||
if let Some(drawing) = &self.0.read().drawing {
|
||||
if drawing.hit_test(point, &local_matrix) {
|
||||
|
|
|
@ -163,7 +163,9 @@ impl<'gc> TDisplayObject<'gc> for MorphShape<'gc> {
|
|||
&& self.world_bounds().contains(point)
|
||||
{
|
||||
if let Some(frame) = self.0.read().static_data.frames.borrow().get(&self.ratio()) {
|
||||
let Some(local_matrix) = self.global_to_local_matrix() else { return false; };
|
||||
let Some(local_matrix) = self.global_to_local_matrix() else {
|
||||
return false;
|
||||
};
|
||||
return ruffle_render::shape_utils::shape_hit_test(
|
||||
&frame.shape,
|
||||
local_matrix * point,
|
||||
|
|
|
@ -2611,7 +2611,9 @@ impl<'gc> TDisplayObject<'gc> for MovieClip<'gc> {
|
|||
}
|
||||
|
||||
if self.world_bounds().contains(point) {
|
||||
let Some(local_matrix) = self.global_to_local_matrix() else { return false; };
|
||||
let Some(local_matrix) = self.global_to_local_matrix() else {
|
||||
return false;
|
||||
};
|
||||
if let Some(masker) = self.masker() {
|
||||
if !masker.hit_test_shape(context, point, HitTestOptions::SKIP_INVISIBLE) {
|
||||
return false;
|
||||
|
@ -2911,7 +2913,9 @@ impl<'gc> TInteractiveObject<'gc> for MovieClip<'gc> {
|
|||
) -> Option<InteractiveObject<'gc>> {
|
||||
if self.visible() {
|
||||
let this: InteractiveObject<'gc> = (*self).into();
|
||||
let Some(local_matrix) = self.global_to_local_matrix() else { return None; };
|
||||
let Some(local_matrix) = self.global_to_local_matrix() else {
|
||||
return None;
|
||||
};
|
||||
|
||||
if let Some(masker) = self.masker() {
|
||||
if !masker.hit_test_shape(context, point, HitTestOptions::SKIP_INVISIBLE) {
|
||||
|
@ -2996,7 +3000,9 @@ impl<'gc> TInteractiveObject<'gc> for MovieClip<'gc> {
|
|||
) -> Avm2MousePick<'gc> {
|
||||
if self.visible() {
|
||||
let this: InteractiveObject<'gc> = (*self).into();
|
||||
let Some(local_matrix) = self.global_to_local_matrix() else { return Avm2MousePick::Miss; };
|
||||
let Some(local_matrix) = self.global_to_local_matrix() else {
|
||||
return Avm2MousePick::Miss;
|
||||
};
|
||||
|
||||
if let Some(masker) = self.masker() {
|
||||
if !masker.hit_test_shape(context, point, HitTestOptions::SKIP_INVISIBLE) {
|
||||
|
|
|
@ -184,9 +184,13 @@ impl<'gc> TDisplayObject<'gc> for Text<'gc> {
|
|||
}
|
||||
|
||||
// Transform the point into the text's local space.
|
||||
let Some(local_matrix) = self.global_to_local_matrix() else { return false; };
|
||||
let Some(local_matrix) = self.global_to_local_matrix() else {
|
||||
return false;
|
||||
};
|
||||
let tf = self.0.read();
|
||||
let Some(text_matrix) = tf.static_data.text_transform.inverse() else { return false; };
|
||||
let Some(text_matrix) = tf.static_data.text_transform.inverse() else {
|
||||
return false;
|
||||
};
|
||||
point = text_matrix * local_matrix * point;
|
||||
|
||||
let mut font_id = 0;
|
||||
|
@ -214,7 +218,9 @@ impl<'gc> TDisplayObject<'gc> for Text<'gc> {
|
|||
for c in &block.glyphs {
|
||||
if let Some(glyph) = font.get_glyph(c.index as usize) {
|
||||
// Transform the point into glyph space and test.
|
||||
let Some(matrix) = glyph_matrix.inverse() else { return false; };
|
||||
let Some(matrix) = glyph_matrix.inverse() else {
|
||||
return false;
|
||||
};
|
||||
let point = matrix * point;
|
||||
let glyph_shape = glyph.as_shape();
|
||||
if glyph_shape.shape_bounds.contains(point)
|
||||
|
|
Loading…
Reference in New Issue