diff options
author | Christopher Durham <[email protected]> | 2018-01-27 23:51:12 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2018-01-27 23:51:12 +0000 |
commit | e6e61251abb68b3e6a47fd3708f4dea6059a9ec3 (patch) | |
tree | c22cfa06a26add11f3aefca3806f0009dd25d923 /src/lexer/ptr.rs | |
parent | 357cd3358167daa38f3ff34d225e1501faff6015 (diff) | |
parent | 9140b3e7286efae57ee8c49c7bfcad8737f9c6fc (diff) |
Merge pull request #12 from CAD97/enforce-fmt
Enforce rustfmt format
Diffstat (limited to 'src/lexer/ptr.rs')
-rw-r--r-- | src/lexer/ptr.rs | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/lexer/ptr.rs b/src/lexer/ptr.rs index ff6ef11fc..99d55b283 100644 --- a/src/lexer/ptr.rs +++ b/src/lexer/ptr.rs | |||
@@ -1,4 +1,4 @@ | |||
1 | use {TextUnit}; | 1 | use TextUnit; |
2 | 2 | ||
3 | use std::str::Chars; | 3 | use std::str::Chars; |
4 | 4 | ||
@@ -9,7 +9,10 @@ pub(crate) struct Ptr<'s> { | |||
9 | 9 | ||
10 | impl<'s> Ptr<'s> { | 10 | impl<'s> Ptr<'s> { |
11 | pub fn new(text: &'s str) -> Ptr<'s> { | 11 | pub fn new(text: &'s str) -> Ptr<'s> { |
12 | Ptr { text, len: TextUnit::new(0) } | 12 | Ptr { |
13 | text, | ||
14 | len: TextUnit::new(0), | ||
15 | } | ||
13 | } | 16 | } |
14 | 17 | ||
15 | pub fn into_len(self) -> TextUnit { | 18 | pub fn into_len(self) -> TextUnit { |
@@ -53,7 +56,7 @@ impl<'s> Ptr<'s> { | |||
53 | match self.next() { | 56 | match self.next() { |
54 | Some(c) if pred(c) => { | 57 | Some(c) if pred(c) => { |
55 | self.bump(); | 58 | self.bump(); |
56 | }, | 59 | } |
57 | _ => return, | 60 | _ => return, |
58 | } | 61 | } |
59 | } | 62 | } |
@@ -66,6 +69,6 @@ impl<'s> Ptr<'s> { | |||
66 | 69 | ||
67 | fn chars(&self) -> Chars { | 70 | fn chars(&self) -> Chars { |
68 | let len: u32 = self.len.into(); | 71 | let len: u32 = self.len.into(); |
69 | self.text[len as usize ..].chars() | 72 | self.text[len as usize..].chars() |
70 | } | 73 | } |
71 | } | 74 | } |