summaryrefslogtreecommitdiff
path: root/library/src/text
diff options
context:
space:
mode:
Diffstat (limited to 'library/src/text')
-rw-r--r--library/src/text/deco.rs6
-rw-r--r--library/src/text/raw.rs2
-rw-r--r--library/src/text/shaping.rs2
3 files changed, 6 insertions, 4 deletions
diff --git a/library/src/text/deco.rs b/library/src/text/deco.rs
index ab89e6b5..7b90b22f 100644
--- a/library/src/text/deco.rs
+++ b/library/src/text/deco.rs
@@ -315,11 +315,13 @@ pub(super) fn decorate(
// Only do the costly segments intersection test if the line
// intersects the bounding box.
- if bbox.map_or(false, |bbox| {
+ let intersect = bbox.map_or(false, |bbox| {
let y_min = -text.font.to_em(bbox.y_max).at(text.size);
let y_max = -text.font.to_em(bbox.y_min).at(text.size);
offset >= y_min && offset <= y_max
- }) {
+ });
+
+ if intersect {
// Find all intersections of segments with the line.
intersections.extend(
path.segments()
diff --git a/library/src/text/raw.rs b/library/src/text/raw.rs
index c6fba253..6d90bc5b 100644
--- a/library/src/text/raw.rs
+++ b/library/src/text/raw.rs
@@ -285,7 +285,7 @@ fn to_syn(RgbaColor { r, g, b, a }: RgbaColor) -> synt::Color {
/// The syntect syntax definitions.
static SYNTAXES: Lazy<syntect::parsing::SyntaxSet> =
- Lazy::new(|| syntect::parsing::SyntaxSet::load_defaults_nonewlines());
+ Lazy::new(syntect::parsing::SyntaxSet::load_defaults_nonewlines);
/// The default theme used for syntax highlighting.
pub static THEME: Lazy<synt::Theme> = Lazy::new(|| synt::Theme {
diff --git a/library/src/text/shaping.rs b/library/src/text/shaping.rs
index 0e5e0a73..50c4bcbd 100644
--- a/library/src/text/shaping.rs
+++ b/library/src/text/shaping.rs
@@ -379,7 +379,7 @@ impl<'a> ShapedText<'a> {
// RTL needs offset one because the left side of the range should be
// exclusive and the right side inclusive, contrary to the normal
// behaviour of ranges.
- self.glyphs[idx].safe_to_break.then(|| idx + (!ltr) as usize)
+ self.glyphs[idx].safe_to_break.then_some(idx + usize::from(!ltr))
}
}