chore: Use matches!(...) in more places
This commit is contained in:
parent
9dc63a7831
commit
0f8f0986e9
|
@ -105,10 +105,7 @@ impl<'gc> Property<'gc> {
|
|||
}
|
||||
|
||||
pub fn is_virtual(&self) -> bool {
|
||||
match self {
|
||||
Property::Virtual { .. } => true,
|
||||
Property::Stored { .. } => false,
|
||||
}
|
||||
matches!(self, Property::Virtual { .. })
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -812,19 +812,11 @@ impl<'gc> LayoutBox<'gc> {
|
|||
}
|
||||
|
||||
pub fn is_text_box(&self) -> bool {
|
||||
match &self.content {
|
||||
LayoutContent::Text { .. } => true,
|
||||
LayoutContent::Bullet { .. } => false,
|
||||
LayoutContent::Drawing(..) => false,
|
||||
}
|
||||
matches!(&self.content, LayoutContent::Text { .. })
|
||||
}
|
||||
|
||||
pub fn is_bullet(&self) -> bool {
|
||||
match &self.content {
|
||||
LayoutContent::Text { .. } => false,
|
||||
LayoutContent::Bullet { .. } => true,
|
||||
LayoutContent::Drawing(..) => false,
|
||||
}
|
||||
matches!(&self.content, LayoutContent::Bullet { .. })
|
||||
}
|
||||
|
||||
/// Construct a duplicate layout box structure.
|
||||
|
|
|
@ -121,10 +121,7 @@ pub enum AvmObject<'gc> {
|
|||
impl<'gc> AvmObject<'gc> {
|
||||
/// Determine if this object is an AVM1 object.
|
||||
pub fn is_avm1_object(&self) -> bool {
|
||||
match self {
|
||||
Self::Avm1(_) => true,
|
||||
Self::Avm2(_) => false,
|
||||
}
|
||||
matches!(self, Self::Avm1(_))
|
||||
}
|
||||
|
||||
/// Attempt to access the AVM1 claim to this object, generating an error if
|
||||
|
@ -138,10 +135,7 @@ impl<'gc> AvmObject<'gc> {
|
|||
|
||||
/// Determine if this object is an AVM2 object.
|
||||
pub fn is_avm2_object(&self) -> bool {
|
||||
match self {
|
||||
Self::Avm1(_) => false,
|
||||
Self::Avm2(_) => true,
|
||||
}
|
||||
matches!(self, Self::Avm2(_))
|
||||
}
|
||||
|
||||
/// Attempt to access the AVM2 claim to this object, generating an error if
|
||||
|
|
|
@ -83,26 +83,17 @@ impl<'gc> Step<'gc> {
|
|||
|
||||
/// Yields true if this step entered an element.
|
||||
pub fn stepped_in(self) -> bool {
|
||||
match self {
|
||||
Self::In(_) => true,
|
||||
Self::Around(_) | Self::Out(_) => false,
|
||||
}
|
||||
matches!(self, Self::In(_))
|
||||
}
|
||||
|
||||
/// Yields true if this step encountered a non-element node.
|
||||
pub fn stepped_around(self) -> bool {
|
||||
match self {
|
||||
Self::Around(_) => true,
|
||||
Self::In(_) | Self::Out(_) => false,
|
||||
}
|
||||
matches!(self, Self::Around(_))
|
||||
}
|
||||
|
||||
/// Yields true if this step exited an element.
|
||||
pub fn stepped_out(self) -> bool {
|
||||
match self {
|
||||
Self::Out(_) => true,
|
||||
Self::Around(_) | Self::In(_) => false,
|
||||
}
|
||||
matches!(self, Self::Out(_))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue