diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-01-09 12:20:05 +0000 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-01-09 12:20:05 +0000 |
commit | 76b3985d70f850e22e6cc630230e56dd7cb96f9a (patch) | |
tree | d0d9586bcdf5d8efc1b7d031810ece7093c482d3 /crates/ra_hir/src/code_model_api.rs | |
parent | c0f48f9eb091b5054acb98575c69c67a0aeefb7b (diff) | |
parent | 0b8fbb4fad97d2980f0070a23f5365a5ed887e2a (diff) |
Merge #473
473: Partial typo fix r=matklad a=marcusklaas
This fixes some typos. Mostly in documentation, but also some code is affected (`defenition` was used in a few method names).
Co-authored-by: Marcus Klaas de Vries <[email protected]>
Diffstat (limited to 'crates/ra_hir/src/code_model_api.rs')
-rw-r--r-- | crates/ra_hir/src/code_model_api.rs | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/crates/ra_hir/src/code_model_api.rs b/crates/ra_hir/src/code_model_api.rs index 902032e14..66c016180 100644 --- a/crates/ra_hir/src/code_model_api.rs +++ b/crates/ra_hir/src/code_model_api.rs | |||
@@ -13,8 +13,8 @@ use crate::{ | |||
13 | ty::InferenceResult, | 13 | ty::InferenceResult, |
14 | }; | 14 | }; |
15 | 15 | ||
16 | /// hir::Crate describes a single crate. It's the main inteface with which | 16 | /// hir::Crate describes a single crate. It's the main interface with which |
17 | /// crate's dependencies interact. Mostly, it should be just a proxy for the | 17 | /// a crate's dependencies interact. Mostly, it should be just a proxy for the |
18 | /// root module. | 18 | /// root module. |
19 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 19 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
20 | pub struct Crate { | 20 | pub struct Crate { |
@@ -75,9 +75,10 @@ impl Module { | |||
75 | } | 75 | } |
76 | 76 | ||
77 | /// Returns a node which defines this module. That is, a file or a `mod foo {}` with items. | 77 | /// Returns a node which defines this module. That is, a file or a `mod foo {}` with items. |
78 | pub fn defenition_source(&self, db: &impl HirDatabase) -> Cancelable<(FileId, ModuleSource)> { | 78 | pub fn definition_source(&self, db: &impl HirDatabase) -> Cancelable<(FileId, ModuleSource)> { |
79 | self.defenition_source_impl(db) | 79 | self.definition_source_impl(db) |
80 | } | 80 | } |
81 | |||
81 | /// Returns a node which declares this module, either a `mod foo;` or a `mod foo {}`. | 82 | /// Returns a node which declares this module, either a `mod foo;` or a `mod foo {}`. |
82 | /// `None` for the crate root. | 83 | /// `None` for the crate root. |
83 | pub fn declaration_source( | 84 | pub fn declaration_source( |
@@ -91,20 +92,24 @@ impl Module { | |||
91 | pub fn krate(&self, db: &impl HirDatabase) -> Cancelable<Option<Crate>> { | 92 | pub fn krate(&self, db: &impl HirDatabase) -> Cancelable<Option<Crate>> { |
92 | self.krate_impl(db) | 93 | self.krate_impl(db) |
93 | } | 94 | } |
95 | |||
94 | /// Topmost parent of this module. Every module has a `crate_root`, but some | 96 | /// Topmost parent of this module. Every module has a `crate_root`, but some |
95 | /// might miss `krate`. This can happen if a module's file is not included | 97 | /// might be missing `krate`. This can happen if a module's file is not included |
96 | /// into any module tree of any target from Cargo.toml. | 98 | /// in the module tree of any target in Cargo.toml. |
97 | pub fn crate_root(&self, db: &impl HirDatabase) -> Cancelable<Module> { | 99 | pub fn crate_root(&self, db: &impl HirDatabase) -> Cancelable<Module> { |
98 | self.crate_root_impl(db) | 100 | self.crate_root_impl(db) |
99 | } | 101 | } |
102 | |||
100 | /// Finds a child module with the specified name. | 103 | /// Finds a child module with the specified name. |
101 | pub fn child(&self, db: &impl HirDatabase, name: &Name) -> Cancelable<Option<Module>> { | 104 | pub fn child(&self, db: &impl HirDatabase, name: &Name) -> Cancelable<Option<Module>> { |
102 | self.child_impl(db, name) | 105 | self.child_impl(db, name) |
103 | } | 106 | } |
107 | |||
104 | /// Finds a parent module. | 108 | /// Finds a parent module. |
105 | pub fn parent(&self, db: &impl HirDatabase) -> Cancelable<Option<Module>> { | 109 | pub fn parent(&self, db: &impl HirDatabase) -> Cancelable<Option<Module>> { |
106 | self.parent_impl(db) | 110 | self.parent_impl(db) |
107 | } | 111 | } |
112 | |||
108 | pub fn path_to_root(&self, db: &impl HirDatabase) -> Cancelable<Vec<Module>> { | 113 | pub fn path_to_root(&self, db: &impl HirDatabase) -> Cancelable<Vec<Module>> { |
109 | let mut res = vec![self.clone()]; | 114 | let mut res = vec![self.clone()]; |
110 | let mut curr = self.clone(); | 115 | let mut curr = self.clone(); |
@@ -114,13 +119,16 @@ impl Module { | |||
114 | } | 119 | } |
115 | Ok(res) | 120 | Ok(res) |
116 | } | 121 | } |
122 | |||
117 | /// Returns a `ModuleScope`: a set of items, visible in this module. | 123 | /// Returns a `ModuleScope`: a set of items, visible in this module. |
118 | pub fn scope(&self, db: &impl HirDatabase) -> Cancelable<ModuleScope> { | 124 | pub fn scope(&self, db: &impl HirDatabase) -> Cancelable<ModuleScope> { |
119 | self.scope_impl(db) | 125 | self.scope_impl(db) |
120 | } | 126 | } |
127 | |||
121 | pub fn resolve_path(&self, db: &impl HirDatabase, path: &Path) -> Cancelable<PerNs<DefId>> { | 128 | pub fn resolve_path(&self, db: &impl HirDatabase, path: &Path) -> Cancelable<PerNs<DefId>> { |
122 | self.resolve_path_impl(db, path) | 129 | self.resolve_path_impl(db, path) |
123 | } | 130 | } |
131 | |||
124 | pub fn problems( | 132 | pub fn problems( |
125 | &self, | 133 | &self, |
126 | db: &impl HirDatabase, | 134 | db: &impl HirDatabase, |
@@ -140,6 +148,7 @@ impl StructField { | |||
140 | pub fn name(&self) -> &Name { | 148 | pub fn name(&self) -> &Name { |
141 | &self.name | 149 | &self.name |
142 | } | 150 | } |
151 | |||
143 | pub fn type_ref(&self) -> &TypeRef { | 152 | pub fn type_ref(&self) -> &TypeRef { |
144 | &self.type_ref | 153 | &self.type_ref |
145 | } | 154 | } |
@@ -160,18 +169,21 @@ impl VariantData { | |||
160 | _ => &[], | 169 | _ => &[], |
161 | } | 170 | } |
162 | } | 171 | } |
172 | |||
163 | pub fn is_struct(&self) -> bool { | 173 | pub fn is_struct(&self) -> bool { |
164 | match self { | 174 | match self { |
165 | VariantData::Struct(..) => true, | 175 | VariantData::Struct(..) => true, |
166 | _ => false, | 176 | _ => false, |
167 | } | 177 | } |
168 | } | 178 | } |
179 | |||
169 | pub fn is_tuple(&self) -> bool { | 180 | pub fn is_tuple(&self) -> bool { |
170 | match self { | 181 | match self { |
171 | VariantData::Tuple(..) => true, | 182 | VariantData::Tuple(..) => true, |
172 | _ => false, | 183 | _ => false, |
173 | } | 184 | } |
174 | } | 185 | } |
186 | |||
175 | pub fn is_unit(&self) -> bool { | 187 | pub fn is_unit(&self) -> bool { |
176 | match self { | 188 | match self { |
177 | VariantData::Unit => true, | 189 | VariantData::Unit => true, |