reduce code

This commit is contained in:
yggverse 2024-12-05 06:49:39 +02:00
parent 3d5ca91021
commit 78b7c67038

View File

@ -30,17 +30,13 @@ pub fn format(source_code: &str) -> Vec<(TextTag, String)> {
.set_background_rgba(Some(&color_to_rgba(color))); .set_background_rgba(Some(&color_to_rgba(color)));
} }
if let Some(is_italic) = entity.italic { if entity.italic.is_some_and(|is_italic| is_italic) {
if is_italic {
tag.text_tag.set_style(Style::Italic); tag.text_tag.set_style(Style::Italic);
} }
}
if let Some(is_underline) = entity.underline { if entity.underline.is_some_and(|is_underline| is_underline) {
if is_underline {
tag.text_tag.set_underline(Underline::Single); tag.text_tag.set_underline(Underline::Single);
} }
}
if let Some(is_strikethrough) = entity.strikethrough { if let Some(is_strikethrough) = entity.strikethrough {
tag.text_tag.set_strikethrough(is_strikethrough); tag.text_tag.set_strikethrough(is_strikethrough);