diff options
author | Florian Diebold <[email protected]> | 2019-12-27 10:24:31 +0000 |
---|---|---|
committer | Florian Diebold <[email protected]> | 2019-12-27 10:25:04 +0000 |
commit | 9fd2c813ca355c3a1f10f54993c16e81778b867b (patch) | |
tree | 119623fdc795c0e41a7171abe90d3961f24fac7c /crates | |
parent | dfe95d735bf9bb0d49d2ab90438577089207c8a0 (diff) |
visible_from -> is_visible_from
Diffstat (limited to 'crates')
-rw-r--r-- | crates/ra_hir/src/code_model.rs | 4 | ||||
-rw-r--r-- | crates/ra_hir_def/src/nameres/collector.rs | 6 | ||||
-rw-r--r-- | crates/ra_hir_def/src/visibility.rs | 8 | ||||
-rw-r--r-- | crates/ra_ide/src/completion/complete_dot.rs | 2 |
4 files changed, 10 insertions, 10 deletions
diff --git a/crates/ra_hir/src/code_model.rs b/crates/ra_hir/src/code_model.rs index 9612c86da..488f74cfb 100644 --- a/crates/ra_hir/src/code_model.rs +++ b/crates/ra_hir/src/code_model.rs | |||
@@ -1053,8 +1053,8 @@ impl<T: Into<AttrDef> + Copy> Docs for T { | |||
1053 | 1053 | ||
1054 | pub trait HasVisibility { | 1054 | pub trait HasVisibility { |
1055 | fn visibility(&self, db: &impl HirDatabase) -> Visibility; | 1055 | fn visibility(&self, db: &impl HirDatabase) -> Visibility; |
1056 | fn visible_from(&self, db: &impl HirDatabase, module: Module) -> bool { | 1056 | fn is_visible_from(&self, db: &impl HirDatabase, module: Module) -> bool { |
1057 | let vis = self.visibility(db); | 1057 | let vis = self.visibility(db); |
1058 | vis.visible_from(db, module.id) | 1058 | vis.is_visible_from(db, module.id) |
1059 | } | 1059 | } |
1060 | } | 1060 | } |
diff --git a/crates/ra_hir_def/src/nameres/collector.rs b/crates/ra_hir_def/src/nameres/collector.rs index 30771d510..8a22b0585 100644 --- a/crates/ra_hir_def/src/nameres/collector.rs +++ b/crates/ra_hir_def/src/nameres/collector.rs | |||
@@ -378,7 +378,7 @@ where | |||
378 | .resolutions() | 378 | .resolutions() |
379 | // only keep visible names... | 379 | // only keep visible names... |
380 | .map(|(n, res)| { | 380 | .map(|(n, res)| { |
381 | (n, res.filter_visibility(|v| v.visible_from_other_crate())) | 381 | (n, res.filter_visibility(|v| v.is_visible_from_other_crate())) |
382 | }) | 382 | }) |
383 | .filter(|(_, res)| !res.is_none()) | 383 | .filter(|(_, res)| !res.is_none()) |
384 | .collect::<Vec<_>>(); | 384 | .collect::<Vec<_>>(); |
@@ -398,7 +398,7 @@ where | |||
398 | ( | 398 | ( |
399 | n, | 399 | n, |
400 | res.filter_visibility(|v| { | 400 | res.filter_visibility(|v| { |
401 | v.visible_from_def_map(&self.def_map, module_id) | 401 | v.is_visible_from_def_map(&self.def_map, module_id) |
402 | }), | 402 | }), |
403 | ) | 403 | ) |
404 | }) | 404 | }) |
@@ -492,7 +492,7 @@ where | |||
492 | for (glob_importing_module, glob_import_vis) in glob_imports { | 492 | for (glob_importing_module, glob_import_vis) in glob_imports { |
493 | // we know all resolutions have the same visibility (`vis`), so we | 493 | // we know all resolutions have the same visibility (`vis`), so we |
494 | // just need to check that once | 494 | // just need to check that once |
495 | if !vis.visible_from_def_map(&self.def_map, glob_importing_module) { | 495 | if !vis.is_visible_from_def_map(&self.def_map, glob_importing_module) { |
496 | continue; | 496 | continue; |
497 | } | 497 | } |
498 | self.update_recursive(glob_importing_module, resolutions, glob_import_vis, depth + 1); | 498 | self.update_recursive(glob_importing_module, resolutions, glob_import_vis, depth + 1); |
diff --git a/crates/ra_hir_def/src/visibility.rs b/crates/ra_hir_def/src/visibility.rs index ad3f09981..d8296da4b 100644 --- a/crates/ra_hir_def/src/visibility.rs +++ b/crates/ra_hir_def/src/visibility.rs | |||
@@ -81,7 +81,7 @@ pub enum Visibility { | |||
81 | } | 81 | } |
82 | 82 | ||
83 | impl Visibility { | 83 | impl Visibility { |
84 | pub fn visible_from(self, db: &impl DefDatabase, from_module: ModuleId) -> bool { | 84 | pub fn is_visible_from(self, db: &impl DefDatabase, from_module: ModuleId) -> bool { |
85 | let to_module = match self { | 85 | let to_module = match self { |
86 | Visibility::Module(m) => m, | 86 | Visibility::Module(m) => m, |
87 | Visibility::Public => return true, | 87 | Visibility::Public => return true, |
@@ -91,17 +91,17 @@ impl Visibility { | |||
91 | return false; | 91 | return false; |
92 | } | 92 | } |
93 | let def_map = db.crate_def_map(from_module.krate); | 93 | let def_map = db.crate_def_map(from_module.krate); |
94 | self.visible_from_def_map(&def_map, from_module.local_id) | 94 | self.is_visible_from_def_map(&def_map, from_module.local_id) |
95 | } | 95 | } |
96 | 96 | ||
97 | pub(crate) fn visible_from_other_crate(self) -> bool { | 97 | pub(crate) fn is_visible_from_other_crate(self) -> bool { |
98 | match self { | 98 | match self { |
99 | Visibility::Module(_) => false, | 99 | Visibility::Module(_) => false, |
100 | Visibility::Public => true, | 100 | Visibility::Public => true, |
101 | } | 101 | } |
102 | } | 102 | } |
103 | 103 | ||
104 | pub(crate) fn visible_from_def_map( | 104 | pub(crate) fn is_visible_from_def_map( |
105 | self, | 105 | self, |
106 | def_map: &crate::nameres::CrateDefMap, | 106 | def_map: &crate::nameres::CrateDefMap, |
107 | from_module: crate::LocalModuleId, | 107 | from_module: crate::LocalModuleId, |
diff --git a/crates/ra_ide/src/completion/complete_dot.rs b/crates/ra_ide/src/completion/complete_dot.rs index 13546c143..210a685e4 100644 --- a/crates/ra_ide/src/completion/complete_dot.rs +++ b/crates/ra_ide/src/completion/complete_dot.rs | |||
@@ -38,7 +38,7 @@ pub(super) fn complete_dot(acc: &mut Completions, ctx: &CompletionContext) { | |||
38 | fn complete_fields(acc: &mut Completions, ctx: &CompletionContext, receiver: &Type) { | 38 | fn complete_fields(acc: &mut Completions, ctx: &CompletionContext, receiver: &Type) { |
39 | for receiver in receiver.autoderef(ctx.db) { | 39 | for receiver in receiver.autoderef(ctx.db) { |
40 | for (field, ty) in receiver.fields(ctx.db) { | 40 | for (field, ty) in receiver.fields(ctx.db) { |
41 | if ctx.module.map_or(false, |m| !field.visible_from(ctx.db, m)) { | 41 | if ctx.module.map_or(false, |m| !field.is_visible_from(ctx.db, m)) { |
42 | // Skip private field. FIXME: If the definition location of the | 42 | // Skip private field. FIXME: If the definition location of the |
43 | // field is editable, we should show the completion | 43 | // field is editable, we should show the completion |
44 | continue; | 44 | continue; |