diff options
Diffstat (limited to 'crates/hir_def/src/path.rs')
-rw-r--r-- | crates/hir_def/src/path.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/crates/hir_def/src/path.rs b/crates/hir_def/src/path.rs index a43441b1c..9b8873fd2 100644 --- a/crates/hir_def/src/path.rs +++ b/crates/hir_def/src/path.rs | |||
@@ -46,6 +46,15 @@ pub enum ImportAlias { | |||
46 | Alias(Name), | 46 | Alias(Name), |
47 | } | 47 | } |
48 | 48 | ||
49 | impl Display for ImportAlias { | ||
50 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { | ||
51 | match self { | ||
52 | ImportAlias::Underscore => f.write_str("_"), | ||
53 | ImportAlias::Alias(name) => f.write_str(&name.to_string()), | ||
54 | } | ||
55 | } | ||
56 | } | ||
57 | |||
49 | impl ModPath { | 58 | impl ModPath { |
50 | pub fn from_src(db: &dyn DefDatabase, path: ast::Path, hygiene: &Hygiene) -> Option<ModPath> { | 59 | pub fn from_src(db: &dyn DefDatabase, path: ast::Path, hygiene: &Hygiene) -> Option<ModPath> { |
51 | let ctx = LowerCtx::with_hygiene(db, hygiene); | 60 | let ctx = LowerCtx::with_hygiene(db, hygiene); |