From 78b7c67038030b6074f8e0c952b863b37d8eca2f Mon Sep 17 00:00:00 2001 From: yggverse Date: Thu, 5 Dec 2024 06:49:39 +0200 Subject: [PATCH] reduce code --- .../tab/item/page/content/text/gemini/reader/ansi.rs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/app/browser/window/tab/item/page/content/text/gemini/reader/ansi.rs b/src/app/browser/window/tab/item/page/content/text/gemini/reader/ansi.rs index 5386617e..0b50a4a2 100644 --- a/src/app/browser/window/tab/item/page/content/text/gemini/reader/ansi.rs +++ b/src/app/browser/window/tab/item/page/content/text/gemini/reader/ansi.rs @@ -30,16 +30,12 @@ pub fn format(source_code: &str) -> Vec<(TextTag, String)> { .set_background_rgba(Some(&color_to_rgba(color))); } - if let Some(is_italic) = entity.italic { - if is_italic { - tag.text_tag.set_style(Style::Italic); - } + if entity.italic.is_some_and(|is_italic| is_italic) { + tag.text_tag.set_style(Style::Italic); } - if let Some(is_underline) = entity.underline { - if is_underline { - tag.text_tag.set_underline(Underline::Single); - } + if entity.underline.is_some_and(|is_underline| is_underline) { + tag.text_tag.set_underline(Underline::Single); } if let Some(is_strikethrough) = entity.strikethrough {