aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_db/src/input.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_db/src/input.rs')
-rw-r--r--crates/ra_db/src/input.rs9
1 files changed, 7 insertions, 2 deletions
diff --git a/crates/ra_db/src/input.rs b/crates/ra_db/src/input.rs
index 06d40db96..a6a831afa 100644
--- a/crates/ra_db/src/input.rs
+++ b/crates/ra_db/src/input.rs
@@ -83,6 +83,7 @@ pub struct CrateGraph {
83#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] 83#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
84pub struct CrateId(pub u32); 84pub struct CrateId(pub u32);
85 85
86#[derive(Debug, Clone, PartialEq, Eq)]
86pub struct CrateName(SmolStr); 87pub struct CrateName(SmolStr);
87 88
88impl CrateName { 89impl CrateName {
@@ -101,6 +102,10 @@ impl CrateName {
101 pub fn normalize_dashes(name: &str) -> CrateName { 102 pub fn normalize_dashes(name: &str) -> CrateName {
102 Self(SmolStr::new(name.replace('-', "_"))) 103 Self(SmolStr::new(name.replace('-', "_")))
103 } 104 }
105
106 pub fn get_name(&self) -> String {
107 self.0.to_string()
108 }
104} 109}
105 110
106#[derive(Debug, Clone, PartialEq, Eq)] 111#[derive(Debug, Clone, PartialEq, Eq)]
@@ -110,7 +115,7 @@ pub struct CrateData {
110 /// The name to display to the end user. 115 /// The name to display to the end user.
111 /// This actual crate name can be different in a particular dependent crate 116 /// This actual crate name can be different in a particular dependent crate
112 /// or may even be missing for some cases, such as a dummy crate for the code snippet. 117 /// or may even be missing for some cases, such as a dummy crate for the code snippet.
113 pub display_name: Option<String>, 118 pub display_name: Option<CrateName>,
114 pub cfg_options: CfgOptions, 119 pub cfg_options: CfgOptions,
115 pub env: Env, 120 pub env: Env,
116 pub extern_source: ExternSource, 121 pub extern_source: ExternSource,
@@ -150,7 +155,7 @@ impl CrateGraph {
150 &mut self, 155 &mut self,
151 file_id: FileId, 156 file_id: FileId,
152 edition: Edition, 157 edition: Edition,
153 display_name: Option<String>, 158 display_name: Option<CrateName>,
154 cfg_options: CfgOptions, 159 cfg_options: CfgOptions,
155 env: Env, 160 env: Env,
156 extern_source: ExternSource, 161 extern_source: ExternSource,