diff options
Diffstat (limited to 'crates/ide_assists/src/handlers/fix_visibility.rs')
-rw-r--r-- | crates/ide_assists/src/handlers/fix_visibility.rs | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/crates/ide_assists/src/handlers/fix_visibility.rs b/crates/ide_assists/src/handlers/fix_visibility.rs index 89f7b2c2c..f834bf16a 100644 --- a/crates/ide_assists/src/handlers/fix_visibility.rs +++ b/crates/ide_assists/src/handlers/fix_visibility.rs | |||
@@ -43,7 +43,7 @@ fn add_vis_to_referenced_module_def(acc: &mut Assists, ctx: &AssistContext) -> O | |||
43 | _ => return None, | 43 | _ => return None, |
44 | }; | 44 | }; |
45 | 45 | ||
46 | let current_module = ctx.sema.scope(&path.syntax()).module()?; | 46 | let current_module = ctx.sema.scope(path.syntax()).module()?; |
47 | let target_module = def.module(ctx.db())?; | 47 | let target_module = def.module(ctx.db())?; |
48 | 48 | ||
49 | let vis = target_module.visibility_of(ctx.db(), &def)?; | 49 | let vis = target_module.visibility_of(ctx.db(), &def)?; |
@@ -361,8 +361,6 @@ pub struct Foo { pub bar: () } | |||
361 | } | 361 | } |
362 | 362 | ||
363 | #[test] | 363 | #[test] |
364 | #[ignore] | ||
365 | // FIXME reenable this test when `Semantics::resolve_record_field` works with union fields | ||
366 | fn fix_visibility_of_union_field() { | 364 | fn fix_visibility_of_union_field() { |
367 | check_assist( | 365 | check_assist( |
368 | fix_visibility, | 366 | fix_visibility, |
@@ -583,25 +581,25 @@ pub struct Foo { pub(crate) bar: () } | |||
583 | } | 581 | } |
584 | 582 | ||
585 | #[test] | 583 | #[test] |
586 | #[ignore] | ||
587 | // FIXME handle reexports properly | ||
588 | fn fix_visibility_of_reexport() { | 584 | fn fix_visibility_of_reexport() { |
585 | // FIXME: broken test, this should fix visibility of the re-export | ||
586 | // rather than the struct. | ||
589 | check_assist( | 587 | check_assist( |
590 | fix_visibility, | 588 | fix_visibility, |
591 | r" | 589 | r#" |
592 | mod foo { | 590 | mod foo { |
593 | use bar::Baz; | 591 | use bar::Baz; |
594 | mod bar { pub(super) struct Baz; } | 592 | mod bar { pub(super) struct Baz; } |
595 | } | 593 | } |
596 | foo::Baz$0 | 594 | foo::Baz$0 |
597 | ", | 595 | "#, |
598 | r" | 596 | r#" |
599 | mod foo { | 597 | mod foo { |
600 | $0pub(crate) use bar::Baz; | 598 | use bar::Baz; |
601 | mod bar { pub(super) struct Baz; } | 599 | mod bar { $0pub(crate) struct Baz; } |
602 | } | 600 | } |
603 | foo::Baz | 601 | foo::Baz |
604 | ", | 602 | "#, |
605 | ) | 603 | ) |
606 | } | 604 | } |
607 | } | 605 | } |