aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_ty/src/tests.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir_ty/src/tests.rs')
-rw-r--r--crates/ra_hir_ty/src/tests.rs28
1 files changed, 7 insertions, 21 deletions
diff --git a/crates/ra_hir_ty/src/tests.rs b/crates/ra_hir_ty/src/tests.rs
index c1f6fbab8..28faccf38 100644
--- a/crates/ra_hir_ty/src/tests.rs
+++ b/crates/ra_hir_ty/src/tests.rs
@@ -544,7 +544,7 @@ fn missing_unsafe_diagnostic_with_raw_ptr() {
544 r" 544 r"
545//- /lib.rs 545//- /lib.rs
546fn missing_unsafe() { 546fn missing_unsafe() {
547 let x = &5 as *usize; 547 let x = &5 as *const usize;
548 let y = *x; 548 let y = *x;
549} 549}
550", 550",
@@ -552,7 +552,7 @@ fn missing_unsafe() {
552 .diagnostics() 552 .diagnostics()
553 .0; 553 .0;
554 554
555 assert_snapshot!(diagnostics, @r#""fn missing_unsafe() {\n let x = &5 as *usize;\n let y = *x;\n}": Missing unsafe keyword on fn"#); 555 assert_snapshot!(diagnostics, @r#""fn missing_unsafe() {\n let x = &5 as *const usize;\n let y = *x;\n}": Missing unsafe keyword on fn"#);
556} 556}
557 557
558#[test] 558#[test]
@@ -561,7 +561,7 @@ fn missing_unsafe_diagnostic_with_unsafe_call() {
561 r" 561 r"
562//- /lib.rs 562//- /lib.rs
563unsafe fn unsafe_fn() { 563unsafe fn unsafe_fn() {
564 let x = &5 as *usize; 564 let x = &5 as *const usize;
565 let y = *x; 565 let y = *x;
566} 566}
567 567
@@ -585,7 +585,7 @@ struct HasUnsafe;
585 585
586impl HasUnsafe { 586impl HasUnsafe {
587 unsafe fn unsafe_fn() { 587 unsafe fn unsafe_fn() {
588 let x = &5 as *usize; 588 let x = &5 as *const usize;
589 let y = *x; 589 let y = *x;
590 } 590 }
591} 591}
@@ -609,7 +609,7 @@ fn no_missing_unsafe_diagnostic_with_raw_ptr_in_unsafe_block() {
609//- /lib.rs 609//- /lib.rs
610fn nothing_to_see_move_along() { 610fn nothing_to_see_move_along() {
611 unsafe { 611 unsafe {
612 let x = &5 as *usize; 612 let x = &5 as *const usize;
613 let y = *x; 613 let y = *x;
614 } 614 }
615} 615}
@@ -627,7 +627,7 @@ fn no_missing_unsafe_diagnostic_with_unsafe_call_in_unsafe_block() {
627 r" 627 r"
628//- /lib.rs 628//- /lib.rs
629unsafe fn unsafe_fn() { 629unsafe fn unsafe_fn() {
630 let x = &5 as *usize; 630 let x = &5 as *const usize;
631 let y = *x; 631 let y = *x;
632} 632}
633 633
@@ -653,7 +653,7 @@ struct HasUnsafe;
653 653
654impl HasUnsafe { 654impl HasUnsafe {
655 unsafe fn unsafe_fn() { 655 unsafe fn unsafe_fn() {
656 let x = &5 as *usize; 656 let x = &5 as *const usize;
657 let y = *x; 657 let y = *x;
658 } 658 }
659} 659}
@@ -673,20 +673,6 @@ fn nothing_to_see_move_along() {
673} 673}
674 674
675#[test] 675#[test]
676fn unnecessary_unsafe_diagnostic() {
677 let diagnostics = TestDB::with_files(
678 r"
679//- /lib.rs
680unsafe fn actually_safe_fn() {}
681",
682 )
683 .diagnostics()
684 .0;
685
686 assert_snapshot!(diagnostics, @r#""unsafe fn actually_safe_fn() {}": Unnecessary unsafe keyword on fn"#);
687}
688
689#[test]
690fn break_outside_of_loop() { 676fn break_outside_of_loop() {
691 let diagnostics = TestDB::with_files( 677 let diagnostics = TestDB::with_files(
692 r" 678 r"