diff options
| author | Marek Barvíř <barvirm@gmail.com> | 2023-04-16 11:10:35 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-04-16 11:10:35 +0200 |
| commit | ee32e7ad1ce26d4eebe601344e0343cfb9c8f9bd (patch) | |
| tree | e704cd3c622acbf9faca558dd808f284a7df78f3 /library/src/text | |
| parent | 261b96da68890dd1054efb76a72ee997cb779bae (diff) | |
Clippy fixes (#581)
Diffstat (limited to 'library/src/text')
| -rw-r--r-- | library/src/text/deco.rs | 6 | ||||
| -rw-r--r-- | library/src/text/raw.rs | 2 | ||||
| -rw-r--r-- | library/src/text/shaping.rs | 2 |
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)) } } |
