mirror of https://github.com/stelzo/typst.git
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…
Reference in New Issue