From 40159362c08ed8713a05f26ae6c1f14f17c53c0f Mon Sep 17 00:00:00 2001 From: "Carol (Nichols || Goulding)" Date: Mon, 5 Aug 2019 12:56:07 -0400 Subject: [PATCH] Unnest another conditional --- src/preprocess/links.rs | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/src/preprocess/links.rs b/src/preprocess/links.rs index a9f9a0c7..9a0bacf7 100644 --- a/src/preprocess/links.rs +++ b/src/preprocess/links.rs @@ -198,24 +198,15 @@ fn parse_include_path(path: &str) -> LinkType<'static> { let end = parts.next(); let has_end = end.is_some(); let end = end.and_then(|s| s.parse::().ok()); - match start { - Some(start) => match end { - Some(end) => LinkType::IncludeRange(path, LineRange::from(start..end)), - None => { - if has_end { - LinkType::IncludeRange(path, LineRange::from(start..)) - } else { - LinkType::IncludeRange( - path, - LineRange::from(start..start + 1), - ) - } - } - }, - None => match end { - Some(end) => LinkType::IncludeRange(path, LineRange::from(..end)), - None => LinkType::IncludeRange(path, LineRange::from(RangeFull)), - }, + + match (start, end, has_end) { + (Some(start), Some(end), _) => LinkType::IncludeRange(path, LineRange::from(start..end)), + (Some(start), None, true) => LinkType::IncludeRange(path, LineRange::from(start..)), + (Some(start), None, false) => { + LinkType::IncludeRange(path, LineRange::from(start..start + 1)) + } + (None, Some(end), _) => LinkType::IncludeRange(path, LineRange::from(..end)), + (None, None, _) => LinkType::IncludeRange(path, LineRange::from(RangeFull)), } }