aboutsummaryrefslogtreecommitdiff
path: root/crates/ide/src/diagnostics.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ide/src/diagnostics.rs')
-rw-r--r--crates/ide/src/diagnostics.rs21
1 files changed, 3 insertions, 18 deletions
diff --git a/crates/ide/src/diagnostics.rs b/crates/ide/src/diagnostics.rs
index fb956d5ee..aeccf1164 100644
--- a/crates/ide/src/diagnostics.rs
+++ b/crates/ide/src/diagnostics.rs
@@ -416,21 +416,6 @@ mod tests {
416 assert!(diagnostic.fixes.is_none(), "got a fix when none was expected: {:?}", diagnostic); 416 assert!(diagnostic.fixes.is_none(), "got a fix when none was expected: {:?}", diagnostic);
417 } 417 }
418 418
419 /// Takes a multi-file input fixture with annotated cursor position and checks that no diagnostics
420 /// apply to the file containing the cursor.
421 pub(crate) fn check_no_diagnostics(ra_fixture: &str) {
422 let (analysis, files) = fixture::files(ra_fixture);
423 let diagnostics = files
424 .into_iter()
425 .flat_map(|file_id| {
426 analysis
427 .diagnostics(&DiagnosticsConfig::default(), AssistResolveStrategy::All, file_id)
428 .unwrap()
429 })
430 .collect::<Vec<_>>();
431 assert_eq!(diagnostics.len(), 0, "unexpected diagnostics:\n{:#?}", diagnostics);
432 }
433
434 pub(crate) fn check_expect(ra_fixture: &str, expect: Expect) { 419 pub(crate) fn check_expect(ra_fixture: &str, expect: Expect) {
435 let (analysis, file_id) = fixture::file(ra_fixture); 420 let (analysis, file_id) = fixture::file(ra_fixture);
436 let diagnostics = analysis 421 let diagnostics = analysis
@@ -496,7 +481,7 @@ pub struct Foo { pub a: i32, pub b: i32 }
496 481
497 #[test] 482 #[test]
498 fn test_check_unnecessary_braces_in_use_statement() { 483 fn test_check_unnecessary_braces_in_use_statement() {
499 check_no_diagnostics( 484 check_diagnostics(
500 r#" 485 r#"
501use a; 486use a;
502use a::{c, d::e}; 487use a::{c, d::e};
@@ -509,7 +494,7 @@ mod a {
509} 494}
510"#, 495"#,
511 ); 496 );
512 check_no_diagnostics( 497 check_diagnostics(
513 r#" 498 r#"
514use a; 499use a;
515use a::{ 500use a::{
@@ -719,7 +704,7 @@ $0
719 704
720 #[test] 705 #[test]
721 fn unlinked_file_with_cfg_on() { 706 fn unlinked_file_with_cfg_on() {
722 check_no_diagnostics( 707 check_diagnostics(
723 r#" 708 r#"
724//- /main.rs 709//- /main.rs
725#[cfg(not(never))] 710#[cfg(not(never))]