From 7795b155e04dcf245f240f4486485b1099fb4a99 Mon Sep 17 00:00:00 2001 From: Mark Rousskov Date: Tue, 4 Jun 2019 08:57:40 -0600 Subject: [PATCH] Inline raw method --- src/libfmt_macros/lib.rs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/libfmt_macros/lib.rs b/src/libfmt_macros/lib.rs index 6fed83021609d..d5ce389ed5f7f 100644 --- a/src/libfmt_macros/lib.rs +++ b/src/libfmt_macros/lib.rs @@ -302,22 +302,19 @@ impl<'a> Parser<'a> { } } - fn raw(&self) -> usize { - self.style.map(|raw| raw + 1).unwrap_or(0) - } - fn to_span_index(&self, pos: usize) -> SpanIndex { let mut pos = pos; + let raw = self.style.map(|raw| raw + 1).unwrap_or(0); for skip in &self.skips { if pos > *skip { pos += 1; - } else if pos == *skip && self.raw() == 0 { + } else if pos == *skip && raw == 0 { pos += 1; } else { break; } } - SpanIndex(self.raw() + pos + 1) + SpanIndex(raw + pos + 1) } /// Forces consumption of the specified character. If the character is not