aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api/src/diagnostics.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide_api/src/diagnostics.rs')
-rw-r--r--crates/ra_ide_api/src/diagnostics.rs21
1 files changed, 11 insertions, 10 deletions
diff --git a/crates/ra_ide_api/src/diagnostics.rs b/crates/ra_ide_api/src/diagnostics.rs
index 9841fbdf3..0b9bb5a66 100644
--- a/crates/ra_ide_api/src/diagnostics.rs
+++ b/crates/ra_ide_api/src/diagnostics.rs
@@ -217,7 +217,8 @@ mod tests {
217 } 217 }
218 218
219 fn check_apply_diagnostic_fix_for_target_file(target_file: &str, fixture: &str, after: &str) { 219 fn check_apply_diagnostic_fix_for_target_file(target_file: &str, fixture: &str, after: &str) {
220 let (analysis, file_id, target_file_contents) = fixture_with_target_file(fixture, target_file); 220 let (analysis, file_id, target_file_contents) =
221 fixture_with_target_file(fixture, target_file);
221 let diagnostic = analysis.diagnostics(file_id).unwrap().pop().unwrap(); 222 let diagnostic = analysis.diagnostics(file_id).unwrap().pop().unwrap();
222 let mut fix = diagnostic.fix.unwrap(); 223 let mut fix = diagnostic.fix.unwrap();
223 let edit = fix.source_file_edits.pop().unwrap().edit; 224 let edit = fix.source_file_edits.pop().unwrap().edit;
@@ -267,9 +268,9 @@ mod tests {
267 pub enum Result<T, E> { Ok(T), Err(E) } 268 pub enum Result<T, E> { Ok(T), Err(E) }
268 } 269 }
269 "#; 270 "#;
270// The formatting here is a bit odd due to how the parse_fixture function works in test_utils - 271 // The formatting here is a bit odd due to how the parse_fixture function works in test_utils -
271// it strips empty lines and leading whitespace. The important part of this test is that the final 272 // it strips empty lines and leading whitespace. The important part of this test is that the final
272// `x / y` expr is now wrapped in `Ok(..)` 273 // `x / y` expr is now wrapped in `Ok(..)`
273 let after = r#"use std::{string::String, result::Result::{self, Ok, Err}}; 274 let after = r#"use std::{string::String, result::Result::{self, Ok, Err}};
274fn div(x: i32, y: i32) -> Result<i32, String> { 275fn div(x: i32, y: i32) -> Result<i32, String> {
275 if y == 0 { 276 if y == 0 {
@@ -299,9 +300,9 @@ fn div(x: i32, y: i32) -> Result<i32, String> {
299 pub enum Result<T, E> { Ok(T), Err(E) } 300 pub enum Result<T, E> { Ok(T), Err(E) }
300 } 301 }
301 "#; 302 "#;
302// The formatting here is a bit odd due to how the parse_fixture function works in test_utils - 303 // The formatting here is a bit odd due to how the parse_fixture function works in test_utils -
303// it strips empty lines and leading whitespace. The important part of this test is that the final 304 // it strips empty lines and leading whitespace. The important part of this test is that the final
304// expr is now wrapped in `Ok(..)` 305 // expr is now wrapped in `Ok(..)`
305 let after = r#"use std::result::Result::{self, Ok, Err}; 306 let after = r#"use std::result::Result::{self, Ok, Err};
306fn div<T>(x: T) -> Result<T, i32> { 307fn div<T>(x: T) -> Result<T, i32> {
307 if x == 0 { 308 if x == 0 {
@@ -336,9 +337,9 @@ fn div<T>(x: T) -> Result<T, i32> {
336 pub enum Result<T, E> { Ok(T), Err(E) } 337 pub enum Result<T, E> { Ok(T), Err(E) }
337 } 338 }
338 "#; 339 "#;
339// The formatting here is a bit odd due to how the parse_fixture function works in test_utils - 340 // The formatting here is a bit odd due to how the parse_fixture function works in test_utils -
340// it strips empty lines and leading whitespace. The important part of this test is that the final 341 // it strips empty lines and leading whitespace. The important part of this test is that the final
341// `x / y` expr is now wrapped in `Ok(..)` 342 // `x / y` expr is now wrapped in `Ok(..)`
342 let after = r#"use std::{string::String, result::Result::{self, Ok, Err}}; 343 let after = r#"use std::{string::String, result::Result::{self, Ok, Err}};
343type MyResult<T> = Result<T, String>; 344type MyResult<T> = Result<T, String>;
344fn div(x: i32, y: i32) -> MyResult<i32> { 345fn div(x: i32, y: i32) -> MyResult<i32> {