From aa67245743ae366924ef2c870884f61053aafa69 Mon Sep 17 00:00:00 2001 From: "Carol (Nichols || Goulding)" Date: Mon, 5 Aug 2019 12:45:17 -0400 Subject: [PATCH] Unnest a conditional --- src/preprocess/links.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/preprocess/links.rs b/src/preprocess/links.rs index 2b435a3f..a9f9a0c7 100644 --- a/src/preprocess/links.rs +++ b/src/preprocess/links.rs @@ -187,12 +187,10 @@ fn parse_include_path(path: &str) -> LinkType<'static> { let start = if let Some(value) = next_element.and_then(|s| s.parse::().ok()) { // subtract 1 since line numbers usually begin with 1 Some(value.saturating_sub(1)) + } else if let Some("") = next_element { + None } else if let Some(anchor) = next_element { - if anchor == "" { - None - } else { - return LinkType::IncludeAnchor(path, String::from(anchor)); - } + return LinkType::IncludeAnchor(path, String::from(anchor)); } else { None };