aboutsummaryrefslogtreecommitdiff
path: root/crates/base_db
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-10-20 14:38:11 +0100
committerAleksey Kladov <[email protected]>2020-10-20 14:38:11 +0100
commitaf4e75533f2c071330e740e2fa94b131e3a2b538 (patch)
tree6f517a43814751d8b1ea478b5ed03baf57b4f0b5 /crates/base_db
parentbe762ccccd5a86632e60351518528d078785a3e2 (diff)
Rename declaration_name -> display_name
Declaration names sounds like a name of declaration -- something you can use for analysis. It empathically isn't, and is just a label displayed in various UI. It's important not to confuse the two, least we accidentally mix semantics with UI (I believe, there's already a case of this in the FamousDefs at least).
Diffstat (limited to 'crates/base_db')
-rw-r--r--crates/base_db/src/input.rs20
1 files changed, 11 insertions, 9 deletions
diff --git a/crates/base_db/src/input.rs b/crates/base_db/src/input.rs
index b870e2cee..eb3aac88d 100644
--- a/crates/base_db/src/input.rs
+++ b/crates/base_db/src/input.rs
@@ -127,11 +127,13 @@ impl PartialEq for ProcMacro {
127pub struct CrateData { 127pub struct CrateData {
128 pub root_file_id: FileId, 128 pub root_file_id: FileId,
129 pub edition: Edition, 129 pub edition: Edition,
130 /// A name used in the package's project declaration: for Cargo projects, it's [package].name, 130 /// A name used in the package's project declaration: for Cargo projects,
131 /// can be different for other project types or even absent (a dummy crate for the code snippet, for example). 131 /// it's [package].name, can be different for other project types or even
132 /// NOTE: The crate can be referenced as a dependency under a different name, 132 /// absent (a dummy crate for the code snippet, for example).
133 /// this one should be used when working with crate hierarchies. 133 ///
134 pub declaration_name: Option<CrateName>, 134 /// For purposes of analysis, crates are anonymous (only names in
135 /// `Dependency` matters), this name should only be used for UI.
136 pub display_name: Option<CrateName>,
135 pub cfg_options: CfgOptions, 137 pub cfg_options: CfgOptions,
136 pub env: Env, 138 pub env: Env,
137 pub dependencies: Vec<Dependency>, 139 pub dependencies: Vec<Dependency>,
@@ -160,7 +162,7 @@ impl CrateGraph {
160 &mut self, 162 &mut self,
161 file_id: FileId, 163 file_id: FileId,
162 edition: Edition, 164 edition: Edition,
163 declaration_name: Option<CrateName>, 165 display_name: Option<CrateName>,
164 cfg_options: CfgOptions, 166 cfg_options: CfgOptions,
165 env: Env, 167 env: Env,
166 proc_macro: Vec<(SmolStr, Arc<dyn tt::TokenExpander>)>, 168 proc_macro: Vec<(SmolStr, Arc<dyn tt::TokenExpander>)>,
@@ -171,7 +173,7 @@ impl CrateGraph {
171 let data = CrateData { 173 let data = CrateData {
172 root_file_id: file_id, 174 root_file_id: file_id,
173 edition, 175 edition,
174 declaration_name, 176 display_name,
175 cfg_options, 177 cfg_options,
176 env, 178 env,
177 proc_macro, 179 proc_macro,
@@ -310,8 +312,8 @@ impl CrateGraph {
310 } 312 }
311 } 313 }
312 314
313 fn hacky_find_crate(&self, declaration_name: &str) -> Option<CrateId> { 315 fn hacky_find_crate(&self, display_name: &str) -> Option<CrateId> {
314 self.iter().find(|it| self[*it].declaration_name.as_deref() == Some(declaration_name)) 316 self.iter().find(|it| self[*it].display_name.as_deref() == Some(display_name))
315 } 317 }
316} 318}
317 319