diff options
Diffstat (limited to 'crates')
-rw-r--r-- | crates/base_db/src/input.rs | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/crates/base_db/src/input.rs b/crates/base_db/src/input.rs index eb3aac88d..02c7348ff 100644 --- a/crates/base_db/src/input.rs +++ b/crates/base_db/src/input.rs | |||
@@ -102,7 +102,29 @@ impl fmt::Display for CrateName { | |||
102 | 102 | ||
103 | impl ops::Deref for CrateName { | 103 | impl ops::Deref for CrateName { |
104 | type Target = str; | 104 | type Target = str; |
105 | fn deref(&self) -> &Self::Target { | 105 | fn deref(&self) -> &str { |
106 | &*self.0 | ||
107 | } | ||
108 | } | ||
109 | |||
110 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
111 | pub struct CrateDisplayName(CrateName); | ||
112 | |||
113 | impl From<CrateName> for CrateDisplayName { | ||
114 | fn from(inner: CrateName) -> CrateDisplayName { | ||
115 | CrateDisplayName(inner) | ||
116 | } | ||
117 | } | ||
118 | |||
119 | impl fmt::Display for CrateDisplayName { | ||
120 | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { | ||
121 | write!(f, "{}", self.0) | ||
122 | } | ||
123 | } | ||
124 | |||
125 | impl ops::Deref for CrateDisplayName { | ||
126 | type Target = str; | ||
127 | fn deref(&self) -> &str { | ||
106 | &*self.0 | 128 | &*self.0 |
107 | } | 129 | } |
108 | } | 130 | } |