diff options
Diffstat (limited to 'crates/ra_hir/src/name.rs')
-rw-r--r-- | crates/ra_hir/src/name.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/crates/ra_hir/src/name.rs b/crates/ra_hir/src/name.rs index cdad31be7..e4fc141a6 100644 --- a/crates/ra_hir/src/name.rs +++ b/crates/ra_hir/src/name.rs | |||
@@ -5,7 +5,7 @@ use ra_syntax::{ast, SmolStr}; | |||
5 | /// `Name` is a wrapper around string, which is used in hir for both references | 5 | /// `Name` is a wrapper around string, which is used in hir for both references |
6 | /// and declarations. In theory, names should also carry hygene info, but we are | 6 | /// and declarations. In theory, names should also carry hygene info, but we are |
7 | /// not there yet! | 7 | /// not there yet! |
8 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 8 | #[derive(Clone, PartialEq, Eq, Hash)] |
9 | pub struct Name { | 9 | pub struct Name { |
10 | text: SmolStr, | 10 | text: SmolStr, |
11 | } | 11 | } |
@@ -16,6 +16,12 @@ impl fmt::Display for Name { | |||
16 | } | 16 | } |
17 | } | 17 | } |
18 | 18 | ||
19 | impl fmt::Debug for Name { | ||
20 | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { | ||
21 | fmt::Debug::fmt(&self.text, f) | ||
22 | } | ||
23 | } | ||
24 | |||
19 | impl Name { | 25 | impl Name { |
20 | pub(crate) fn as_known_name(&self) -> Option<KnownName> { | 26 | pub(crate) fn as_known_name(&self) -> Option<KnownName> { |
21 | let name = match self.text.as_str() { | 27 | let name = match self.text.as_str() { |
@@ -38,15 +44,9 @@ impl Name { | |||
38 | Some(name) | 44 | Some(name) |
39 | } | 45 | } |
40 | 46 | ||
41 | #[cfg(not(test))] | ||
42 | fn new(text: SmolStr) -> Name { | 47 | fn new(text: SmolStr) -> Name { |
43 | Name { text } | 48 | Name { text } |
44 | } | 49 | } |
45 | |||
46 | #[cfg(test)] | ||
47 | pub(crate) fn new(text: SmolStr) -> Name { | ||
48 | Name { text } | ||
49 | } | ||
50 | } | 50 | } |
51 | 51 | ||
52 | pub(crate) trait AsName { | 52 | pub(crate) trait AsName { |