Skip to content

Commit 7795b15

Browse files
Inline raw method
1 parent 20efb19 commit 7795b15

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/libfmt_macros/lib.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -302,22 +302,19 @@ impl<'a> Parser<'a> {
302302
}
303303
}
304304

305-
fn raw(&self) -> usize {
306-
self.style.map(|raw| raw + 1).unwrap_or(0)
307-
}
308-
309305
fn to_span_index(&self, pos: usize) -> SpanIndex {
310306
let mut pos = pos;
307+
let raw = self.style.map(|raw| raw + 1).unwrap_or(0);
311308
for skip in &self.skips {
312309
if pos > *skip {
313310
pos += 1;
314-
} else if pos == *skip && self.raw() == 0 {
311+
} else if pos == *skip && raw == 0 {
315312
pos += 1;
316313
} else {
317314
break;
318315
}
319316
}
320-
SpanIndex(self.raw() + pos + 1)
317+
SpanIndex(raw + pos + 1)
321318
}
322319

323320
/// Forces consumption of the specified character. If the character is not

0 commit comments

Comments
 (0)