aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src/string_lexing
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_syntax/src/string_lexing')
-rw-r--r--crates/ra_syntax/src/string_lexing/parser.rs9
-rw-r--r--crates/ra_syntax/src/string_lexing/string.rs7
2 files changed, 3 insertions, 13 deletions
diff --git a/crates/ra_syntax/src/string_lexing/parser.rs b/crates/ra_syntax/src/string_lexing/parser.rs
index e835382fc..7469eb903 100644
--- a/crates/ra_syntax/src/string_lexing/parser.rs
+++ b/crates/ra_syntax/src/string_lexing/parser.rs
@@ -24,9 +24,7 @@ impl<'a> Parser<'a> {
24 } 24 }
25 25
26 pub fn advance(&mut self) -> char { 26 pub fn advance(&mut self) -> char {
27 let next = self 27 let next = self.peek().expect("cannot advance if end of input is reached");
28 .peek()
29 .expect("cannot advance if end of input is reached");
30 self.pos += next.len_utf8(); 28 self.pos += next.len_utf8();
31 next 29 next
32 } 30 }
@@ -133,10 +131,7 @@ impl<'a> Parser<'a> {
133 Some(self.parse_escape(start)) 131 Some(self.parse_escape(start))
134 } else { 132 } else {
135 let end = self.get_pos(); 133 let end = self.get_pos();
136 Some(StringComponent::new( 134 Some(StringComponent::new(TextRange::from_to(start, end), CodePoint))
137 TextRange::from_to(start, end),
138 CodePoint,
139 ))
140 } 135 }
141 } 136 }
142 137
diff --git a/crates/ra_syntax/src/string_lexing/string.rs b/crates/ra_syntax/src/string_lexing/string.rs
index 064f08544..a4742a0d1 100644
--- a/crates/ra_syntax/src/string_lexing/string.rs
+++ b/crates/ra_syntax/src/string_lexing/string.rs
@@ -120,12 +120,7 @@ mod tests {
120 fn closed_char_component(src: &str) -> StringComponent { 120 fn closed_char_component(src: &str) -> StringComponent {
121 let (has_closing_quote, components) = parse(src); 121 let (has_closing_quote, components) = parse(src);
122 assert!(has_closing_quote, "char should have closing quote"); 122 assert!(has_closing_quote, "char should have closing quote");
123 assert!( 123 assert!(components.len() == 1, "Literal: {}\nComponents: {:#?}", src, components);
124 components.len() == 1,
125 "Literal: {}\nComponents: {:#?}",
126 src,
127 components
128 );
129 components[0].clone() 124 components[0].clone()
130 } 125 }
131 126