diff options
author | Kirill Bulatov <[email protected]> | 2020-03-16 10:03:43 +0000 |
---|---|---|
committer | Kirill Bulatov <[email protected]> | 2020-03-16 10:03:43 +0000 |
commit | 92fd430dab8cd0c7a476ccc5db87607f3f0f00a2 (patch) | |
tree | 62e0115f59514dbf465182d64e5187aa6fbd50df /crates/ra_db | |
parent | 059ed25a3eea97f370c190803318d5cb7885e1a9 (diff) |
Use Display instead of a custom method
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 | ||