diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-06-13 17:33:03 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2021-06-13 17:33:03 +0100 |
commit | 8e5f469da8d5ed0e4c0519c883498097aeadd7ac (patch) | |
tree | a9c198dde6ff1845ee3bf634bc0de888f4ef40e5 /crates/ide/src/diagnostics.rs | |
parent | a8d815590821c1b689342e443e584d5b69af6341 (diff) | |
parent | dec207f56a7b16075f68dcb89138d93a7eecdf43 (diff) |
Merge #9251
9251: minor: simplify r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ide/src/diagnostics.rs')
-rw-r--r-- | crates/ide/src/diagnostics.rs | 21 |
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#" |
501 | use a; | 486 | use a; |
502 | use a::{c, d::e}; | 487 | use 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#" |
514 | use a; | 499 | use a; |
515 | use a::{ | 500 | use 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))] |