aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src/validation.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_syntax/src/validation.rs')
-rw-r--r--crates/ra_syntax/src/validation.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/crates/ra_syntax/src/validation.rs b/crates/ra_syntax/src/validation.rs
index 7140d10c3..19bdafef2 100644
--- a/crates/ra_syntax/src/validation.rs
+++ b/crates/ra_syntax/src/validation.rs
@@ -33,7 +33,7 @@ fn validate_literal(literal: ast::Literal, acc: &mut Vec<SyntaxError>) {
33 if let Some(end) = text.rfind('\'') { 33 if let Some(end) = text.rfind('\'') {
34 if let Some(without_quotes) = text.get(2..end) { 34 if let Some(without_quotes) = text.get(2..end) {
35 if let Err((off, err)) = unescape::unescape_byte(without_quotes) { 35 if let Err((off, err)) = unescape::unescape_byte(without_quotes) {
36 let off = token.range().start() + TextUnit::from_usize(off + 2); 36 let off = token.text_range().start() + TextUnit::from_usize(off + 2);
37 acc.push(SyntaxError::new(err.into(), off)) 37 acc.push(SyntaxError::new(err.into(), off))
38 } 38 }
39 } 39 }
@@ -43,7 +43,7 @@ fn validate_literal(literal: ast::Literal, acc: &mut Vec<SyntaxError>) {
43 if let Some(end) = text.rfind('\'') { 43 if let Some(end) = text.rfind('\'') {
44 if let Some(without_quotes) = text.get(1..end) { 44 if let Some(without_quotes) = text.get(1..end) {
45 if let Err((off, err)) = unescape::unescape_char(without_quotes) { 45 if let Err((off, err)) = unescape::unescape_char(without_quotes) {
46 let off = token.range().start() + TextUnit::from_usize(off + 1); 46 let off = token.text_range().start() + TextUnit::from_usize(off + 1);
47 acc.push(SyntaxError::new(err.into(), off)) 47 acc.push(SyntaxError::new(err.into(), off))
48 } 48 }
49 } 49 }
@@ -55,7 +55,7 @@ fn validate_literal(literal: ast::Literal, acc: &mut Vec<SyntaxError>) {
55 unescape::unescape_byte_str(without_quotes, &mut |range, char| { 55 unescape::unescape_byte_str(without_quotes, &mut |range, char| {
56 if let Err(err) = char { 56 if let Err(err) = char {
57 let off = range.start; 57 let off = range.start;
58 let off = token.range().start() + TextUnit::from_usize(off + 2); 58 let off = token.text_range().start() + TextUnit::from_usize(off + 2);
59 acc.push(SyntaxError::new(err.into(), off)) 59 acc.push(SyntaxError::new(err.into(), off))
60 } 60 }
61 }) 61 })
@@ -68,7 +68,7 @@ fn validate_literal(literal: ast::Literal, acc: &mut Vec<SyntaxError>) {
68 unescape::unescape_str(without_quotes, &mut |range, char| { 68 unescape::unescape_str(without_quotes, &mut |range, char| {
69 if let Err(err) = char { 69 if let Err(err) = char {
70 let off = range.start; 70 let off = range.start;
71 let off = token.range().start() + TextUnit::from_usize(off + 1); 71 let off = token.text_range().start() + TextUnit::from_usize(off + 1);
72 acc.push(SyntaxError::new(err.into(), off)) 72 acc.push(SyntaxError::new(err.into(), off))
73 } 73 }
74 }) 74 })
@@ -89,9 +89,9 @@ pub(crate) fn validate_block_structure(root: &SyntaxNode) {
89 assert_eq!( 89 assert_eq!(
90 node.parent(), 90 node.parent(),
91 pair.parent(), 91 pair.parent(),
92 "\nunpaired curleys:\n{}\n{}\n", 92 "\nunpaired curleys:\n{}\n{:#?}\n",
93 root.text(), 93 root.text(),
94 root.debug_dump(), 94 root,
95 ); 95 );
96 assert!( 96 assert!(
97 node.next_sibling().is_none() && pair.prev_sibling().is_none(), 97 node.next_sibling().is_none() && pair.prev_sibling().is_none(),