From 11405ce0600d61f3772a7efe7fbd3de4cc2bf892 Mon Sep 17 00:00:00 2001 From: Fuwn Date: Wed, 18 May 2022 01:52:36 +0000 Subject: fix: global clippy lint fixes --- src/convert/markdown.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src/convert/markdown.rs') diff --git a/src/convert/markdown.rs b/src/convert/markdown.rs index b07d5f1..ccd2304 100644 --- a/src/convert/markdown.rs +++ b/src/convert/markdown.rs @@ -30,11 +30,10 @@ pub fn convert(source: Vec) -> String { to, text, } => - markdown.push_str(&if let Some(text) = text { - format!("[{}]({})", text, to) - } else { - format!("<{}>", to) - }), + markdown.push_str(&*text.map_or_else( + || format!("<{}>", to), + |text| format!("[{}]({})", text, to), + )), Node::Heading { level, text, @@ -65,7 +64,7 @@ pub fn convert(source: Vec) -> String { } => { markdown.push_str(&format!( "```{}\n{}```", - alt_text.unwrap_or("".to_string()), + alt_text.unwrap_or_else(|| "".to_string()), text )); } -- cgit v1.2.3