diff options
| author | Leedehai <18319900+Leedehai@users.noreply.github.com> | 2024-07-02 10:41:41 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-07-02 14:41:41 +0000 |
| commit | aefc506424345d3e671df0aafe31330f8becdf6d (patch) | |
| tree | b386b1fcf74545725f999a3f5d3bfc01ca893493 | |
| parent | 6d835ecb9278490f645ad0a1b86ec84e752d3220 (diff) | |
Use a clearer match pattern (#4437)
| -rw-r--r-- | crates/typst/src/math/fragment.rs | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/crates/typst/src/math/fragment.rs b/crates/typst/src/math/fragment.rs index 63c42cbc..da4cb0ad 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 { |
