From f913d4f4b7adabc55f646a0d1e138b64751e1ebe Mon Sep 17 00:00:00 2001 From: Johann Hemmann Date: Tue, 9 Jan 2024 13:38:07 +0100 Subject: [PATCH] Refactor if-else --- crates/ide/src/doc_links.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/crates/ide/src/doc_links.rs b/crates/ide/src/doc_links.rs index 4b0ecb9cf9..f590b14c03 100644 --- a/crates/ide/src/doc_links.rs +++ b/crates/ide/src/doc_links.rs @@ -64,13 +64,12 @@ pub(crate) fn rewrite_links(db: &RootDatabase, markdown: &str, definition: Defin // * path-based links: `../../module/struct.MyStruct.html` // * module-based links (AKA intra-doc links): `super::super::module::MyStruct` if let Some((target, title)) = rewrite_intra_doc_link(db, definition, target, title) { - return (None, target, title); + (None, target, title) + } else if let Some(target) = rewrite_url_link(db, definition, target) { + (Some(LinkType::Inline), target, title.to_string()) + } else { + (None, target.to_string(), title.to_string()) } - if let Some(target) = rewrite_url_link(db, definition, target) { - return (Some(LinkType::Inline), target, title.to_string()); - } - - (None, target.to_string(), title.to_string()) } }); let mut out = String::new();