From aefc506424345d3e671df0aafe31330f8becdf6d Mon Sep 17 00:00:00 2001 From: Leedehai <18319900+Leedehai@users.noreply.github.com> Date: Tue, 2 Jul 2024 10:41:41 -0400 Subject: [PATCH] Use a clearer match pattern (#4437) --- crates/typst/src/math/fragment.rs | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/crates/typst/src/math/fragment.rs b/crates/typst/src/math/fragment.rs index 63c42cbce..da4cb0adc 100644 --- a/crates/typst/src/math/fragment.rs +++ b/crates/typst/src/math/fragment.rs @@ -120,17 +120,18 @@ impl MathFragment { } pub fn is_spaced(&self) -> bool { - self.class() == MathClass::Fence - || match self { - MathFragment::Frame(frame) => { - frame.spaced - && matches!( - frame.class, - MathClass::Normal | MathClass::Alphabetic - ) - } - _ => false, - } + if self.class() == MathClass::Fence { + return true; + } + + matches!( + self, + MathFragment::Frame(FrameFragment { + spaced: true, + class: MathClass::Normal | MathClass::Alphabetic, + .. + }) + ) } pub fn is_text_like(&self) -> bool {