diff options
| author | Laurenz <laurmaedje@gmail.com> | 2021-02-11 17:33:13 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2021-02-11 17:33:13 +0100 |
| commit | 1711b67877ce5c290e049775c340c9324f15341e (patch) | |
| tree | 92d6ff7285cdc2d694ccfdf733ce8757866636ec /src/parse/lines.rs | |
| parent | f9197dcfef11c4c054a460c80ff6023dae6f1f2a (diff) | |
Move all pretty printing into one module and pretty print values 🦋
Diffstat (limited to 'src/parse/lines.rs')
| -rw-r--r-- | src/parse/lines.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/parse/lines.rs b/src/parse/lines.rs index c47b7534..8693af44 100644 --- a/src/parse/lines.rs +++ b/src/parse/lines.rs @@ -1,5 +1,5 @@ use super::Scanner; -use crate::syntax::{Location, Offset, Pos}; +use crate::syntax::{Location, Pos}; /// Enables conversion of byte position to locations. pub struct LineMap<'s> { @@ -44,7 +44,7 @@ impl<'s> LineMap<'s> { pub fn pos(&self, location: Location) -> Option<Pos> { // Determine the boundaries of the line. let line_idx = location.line.checked_sub(1)? as usize; - let line_start = self.line_starts.get(line_idx)?; + let line_start = *self.line_starts.get(line_idx)?; let line_end = self .line_starts .get(location.line as usize) @@ -64,7 +64,7 @@ impl<'s> LineMap<'s> { 0 }; - Some(line_start.offset(Pos(line_offset as u32))) + Some(line_start + line_offset) } } |
