diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2018-10-16 14:44:24 +0100 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2018-10-16 14:44:24 +0100 |
commit | 1216878f7be20dd0e652fb8cdc395009fdcfae07 (patch) | |
tree | 6551967cc8c6e921b66071453ad7888a9121d326 /crates/ra_syntax/src/lexer | |
parent | 39cb6c6d3f78b193f5873c3492e530bbd24d5dd2 (diff) | |
parent | 61f3a438d3a729a6be941bca1ff4c6a97a33f221 (diff) |
Merge #134
134: Cargo Format run r=kjeremy a=kjeremy
I'm not sure how appreciated this is but I figured I would run `cargo fmt` and see what came up.
I made sure that `cargo test` still passes.
Co-authored-by: Jeremy A. Kolb <[email protected]>
Diffstat (limited to 'crates/ra_syntax/src/lexer')
-rw-r--r-- | crates/ra_syntax/src/lexer/mod.rs | 16 | ||||
-rw-r--r-- | crates/ra_syntax/src/lexer/ptr.rs | 8 | ||||
-rw-r--r-- | crates/ra_syntax/src/lexer/strings.rs | 4 |
3 files changed, 16 insertions, 12 deletions
diff --git a/crates/ra_syntax/src/lexer/mod.rs b/crates/ra_syntax/src/lexer/mod.rs index 9dc0b63d6..f388da273 100644 --- a/crates/ra_syntax/src/lexer/mod.rs +++ b/crates/ra_syntax/src/lexer/mod.rs | |||
@@ -58,12 +58,16 @@ fn next_token_inner(c: char, ptr: &mut Ptr) -> SyntaxKind { | |||
58 | } | 58 | } |
59 | 59 | ||
60 | match c { | 60 | match c { |
61 | '#' => if scan_shebang(ptr) { | 61 | '#' => { |
62 | return SHEBANG; | 62 | if scan_shebang(ptr) { |
63 | }, | 63 | return SHEBANG; |
64 | '/' => if let Some(kind) = scan_comment(ptr) { | 64 | } |
65 | return kind; | 65 | } |
66 | }, | 66 | '/' => { |
67 | if let Some(kind) = scan_comment(ptr) { | ||
68 | return kind; | ||
69 | } | ||
70 | } | ||
67 | _ => (), | 71 | _ => (), |
68 | } | 72 | } |
69 | 73 | ||
diff --git a/crates/ra_syntax/src/lexer/ptr.rs b/crates/ra_syntax/src/lexer/ptr.rs index c4708cb1c..fa79d8862 100644 --- a/crates/ra_syntax/src/lexer/ptr.rs +++ b/crates/ra_syntax/src/lexer/ptr.rs | |||
@@ -134,10 +134,10 @@ mod tests { | |||
134 | #[test] | 134 | #[test] |
135 | fn test_nth_is_p() { | 135 | fn test_nth_is_p() { |
136 | let ptr = Ptr::new("test"); | 136 | let ptr = Ptr::new("test"); |
137 | assert!(ptr.nth_is_p(0,|c| c == 't')); | 137 | assert!(ptr.nth_is_p(0, |c| c == 't')); |
138 | assert!(!ptr.nth_is_p(1,|c| c == 't')); | 138 | assert!(!ptr.nth_is_p(1, |c| c == 't')); |
139 | assert!(ptr.nth_is_p(3,|c| c == 't')); | 139 | assert!(ptr.nth_is_p(3, |c| c == 't')); |
140 | assert!(!ptr.nth_is_p(150,|c| c == 't')); | 140 | assert!(!ptr.nth_is_p(150, |c| c == 't')); |
141 | } | 141 | } |
142 | 142 | ||
143 | #[test] | 143 | #[test] |
diff --git a/crates/ra_syntax/src/lexer/strings.rs b/crates/ra_syntax/src/lexer/strings.rs index bceacdcac..5090feae6 100644 --- a/crates/ra_syntax/src/lexer/strings.rs +++ b/crates/ra_syntax/src/lexer/strings.rs | |||
@@ -71,7 +71,7 @@ pub(crate) fn scan_string(ptr: &mut Ptr) { | |||
71 | } | 71 | } |
72 | _ => { | 72 | _ => { |
73 | ptr.bump(); | 73 | ptr.bump(); |
74 | }, | 74 | } |
75 | } | 75 | } |
76 | } | 76 | } |
77 | } | 77 | } |
@@ -90,7 +90,7 @@ pub(crate) fn scan_raw_string(ptr: &mut Ptr) { | |||
90 | while let Some(c) = ptr.bump() { | 90 | while let Some(c) = ptr.bump() { |
91 | if c == '"' { | 91 | if c == '"' { |
92 | let mut hashes_left = hashes; | 92 | let mut hashes_left = hashes; |
93 | while ptr.at('#') && hashes_left > 0{ | 93 | while ptr.at('#') && hashes_left > 0 { |
94 | hashes_left -= 1; | 94 | hashes_left -= 1; |
95 | ptr.bump(); | 95 | ptr.bump(); |
96 | } | 96 | } |