aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_db
diff options
context:
space:
mode:
authorKirill Bulatov <[email protected]>2020-03-16 10:03:43 +0000
committerKirill Bulatov <[email protected]>2020-03-16 10:03:43 +0000
commit92fd430dab8cd0c7a476ccc5db87607f3f0f00a2 (patch)
tree62e0115f59514dbf465182d64e5187aa6fbd50df /crates/ra_db
parent059ed25a3eea97f370c190803318d5cb7885e1a9 (diff)
Use Display instead of a custom method
Diffstat (limited to 'crates/ra_db')
-rw-r--r--crates/ra_db/src/input.rs7
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;
14use rustc_hash::FxHashSet; 14use rustc_hash::FxHashSet;
15 15
16use crate::{RelativePath, RelativePathBuf}; 16use crate::{RelativePath, RelativePathBuf};
17use 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 { 108impl 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