aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_ide/src/diagnostics.rs2
-rw-r--r--crates/ra_syntax/src/parsing/reparsing.rs2
-rw-r--r--crates/ra_syntax/src/syntax_error.rs4
-rw-r--r--crates/ra_syntax/src/tests.rs10
4 files changed, 6 insertions, 12 deletions
diff --git a/crates/ra_ide/src/diagnostics.rs b/crates/ra_ide/src/diagnostics.rs
index 97af98458..82596c665 100644
--- a/crates/ra_ide/src/diagnostics.rs
+++ b/crates/ra_ide/src/diagnostics.rs
@@ -29,7 +29,7 @@ pub(crate) fn diagnostics(db: &RootDatabase, file_id: FileId) -> Vec<Diagnostic>
29 let mut res = Vec::new(); 29 let mut res = Vec::new();
30 30
31 res.extend(parse.errors().iter().map(|err| Diagnostic { 31 res.extend(parse.errors().iter().map(|err| Diagnostic {
32 range: *err.range(), 32 range: err.range(),
33 message: format!("Syntax Error: {}", err), 33 message: format!("Syntax Error: {}", err),
34 severity: Severity::Error, 34 severity: Severity::Error,
35 fix: None, 35 fix: None,
diff --git a/crates/ra_syntax/src/parsing/reparsing.rs b/crates/ra_syntax/src/parsing/reparsing.rs
index 41a355ec7..4faeeab45 100644
--- a/crates/ra_syntax/src/parsing/reparsing.rs
+++ b/crates/ra_syntax/src/parsing/reparsing.rs
@@ -180,7 +180,7 @@ fn merge_errors(
180 } 180 }
181 res.extend(new_errors.into_iter().map(|new_err| { 181 res.extend(new_errors.into_iter().map(|new_err| {
182 // fighting borrow checker with a variable ;) 182 // fighting borrow checker with a variable ;)
183 let offseted_range = *new_err.range() + range_before_reparse.start(); 183 let offseted_range = new_err.range() + range_before_reparse.start();
184 new_err.with_range(offseted_range) 184 new_err.with_range(offseted_range)
185 })); 185 }));
186 res 186 res
diff --git a/crates/ra_syntax/src/syntax_error.rs b/crates/ra_syntax/src/syntax_error.rs
index eaa825cf0..af4584e66 100644
--- a/crates/ra_syntax/src/syntax_error.rs
+++ b/crates/ra_syntax/src/syntax_error.rs
@@ -30,8 +30,8 @@ impl SyntaxError {
30 pub fn message(&self) -> &str { 30 pub fn message(&self) -> &str {
31 &self.0 31 &self.0
32 } 32 }
33 pub fn range(&self) -> &TextRange { 33 pub fn range(&self) -> TextRange {
34 &self.1 34 self.1
35 } 35 }
36 36
37 pub fn with_range(mut self, range: TextRange) -> Self { 37 pub fn with_range(mut self, range: TextRange) -> Self {
diff --git a/crates/ra_syntax/src/tests.rs b/crates/ra_syntax/src/tests.rs
index 2533d0c44..912e6aec0 100644
--- a/crates/ra_syntax/src/tests.rs
+++ b/crates/ra_syntax/src/tests.rs
@@ -128,14 +128,8 @@ fn dump_tokens_and_errors(tokens: &[Token], errors: &[SyntaxError], text: &str)
128 writeln!(acc, "{:?} {} {:?}", token.kind, token_len, token_text).unwrap(); 128 writeln!(acc, "{:?} {} {:?}", token.kind, token_len, token_text).unwrap();
129 } 129 }
130 for err in errors { 130 for err in errors {
131 writeln!( 131 writeln!(acc, "> error{:?} token({:?}) msg({})", err.range(), &text[err.range()], err)
132 acc, 132 .unwrap();
133 "> error{:?} token({:?}) msg({})",
134 err.range(),
135 &text[*err.range()],
136 err.message()
137 )
138 .unwrap();
139 } 133 }
140 acc 134 acc
141} 135}