mirror of
https://github.com/typst/typst
synced 2025-05-16 01:55:28 +08:00
Optimize .count() > 1
check (#1053)
This can be trivially optimized to `.nth(1).is_some()` which obviates evaluating every element in the iterator.
This commit is contained in:
parent
407d8a3ab2
commit
b41cce191c
@ -155,7 +155,7 @@ impl<'a, 'b, 'v> MathContext<'a, 'b, 'v> {
|
|||||||
FrameFragment::new(self, frame).into()
|
FrameFragment::new(self, frame).into()
|
||||||
} else {
|
} else {
|
||||||
// Anything else is handled by Typst's standard text layout.
|
// Anything else is handled by Typst's standard text layout.
|
||||||
let spaced = text.graphemes(true).count() > 1;
|
let spaced = text.graphemes(true).nth(1).is_some();
|
||||||
let mut style = self.style;
|
let mut style = self.style;
|
||||||
if self.style.italic == Smart::Auto {
|
if self.style.italic == Smart::Auto {
|
||||||
style = style.with_italic(false);
|
style = style.with_italic(false);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user