diff options
Diffstat (limited to 'crates/ra_db')
-rw-r--r-- | crates/ra_db/src/input.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/crates/ra_db/src/input.rs b/crates/ra_db/src/input.rs index a6a831afa..bde843001 100644 --- a/crates/ra_db/src/input.rs +++ b/crates/ra_db/src/input.rs | |||
@@ -14,6 +14,7 @@ use rustc_hash::FxHashMap; | |||
14 | use rustc_hash::FxHashSet; | 14 | use rustc_hash::FxHashSet; |
15 | 15 | ||
16 | use crate::{RelativePath, RelativePathBuf}; | 16 | use crate::{RelativePath, RelativePathBuf}; |
17 | use fmt::Display; | ||
17 | 18 | ||
18 | /// `FileId` is an integer which uniquely identifies a file. File paths are | 19 | /// `FileId` is an integer which uniquely identifies a file. File paths are |
19 | /// messy and system-dependent, so most of the code should work directly with | 20 | /// messy and system-dependent, so most of the code should work directly with |
@@ -102,9 +103,11 @@ impl CrateName { | |||
102 | pub fn normalize_dashes(name: &str) -> CrateName { | 103 | pub fn normalize_dashes(name: &str) -> CrateName { |
103 | Self(SmolStr::new(name.replace('-', "_"))) | 104 | Self(SmolStr::new(name.replace('-', "_"))) |
104 | } | 105 | } |
106 | } | ||
105 | 107 | ||
106 | pub fn get_name(&self) -> String { | 108 | impl Display for CrateName { |
107 | self.0.to_string() | 109 | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { |
110 | write!(f, "{}", self.0) | ||
108 | } | 111 | } |
109 | } | 112 | } |
110 | 113 | ||