diff options
author | oxalica <[email protected]> | 2021-03-15 17:24:21 +0000 |
---|---|---|
committer | oxalica <[email protected]> | 2021-03-15 17:24:21 +0000 |
commit | 73fc05fdca348a899c78f527d08f323cd582100d (patch) | |
tree | 17956c67d649f1e7bfa0d67889fda542d47dcb78 | |
parent | 7c855c940a5fdb5c942ddb3d3401c6e2dbbfca67 (diff) |
Pretty print root module of extern crates
-rw-r--r-- | crates/hir/src/display.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/crates/hir/src/display.rs b/crates/hir/src/display.rs index e3660442c..44cdcc296 100644 --- a/crates/hir/src/display.rs +++ b/crates/hir/src/display.rs | |||
@@ -431,6 +431,10 @@ impl HirDisplay for Module { | |||
431 | // FIXME: Module doesn't have visibility saved in data. | 431 | // FIXME: Module doesn't have visibility saved in data. |
432 | match self.name(f.db) { | 432 | match self.name(f.db) { |
433 | Some(name) => write!(f, "mod {}", name), | 433 | Some(name) => write!(f, "mod {}", name), |
434 | None if self.crate_root(f.db) == *self => match self.krate().display_name(f.db) { | ||
435 | Some(name) => write!(f, "extern crate {}", name), | ||
436 | None => write!(f, "extern crate {{unknown}}"), | ||
437 | }, | ||
434 | None => write!(f, "mod {{unnamed}}"), | 438 | None => write!(f, "mod {{unnamed}}"), |
435 | } | 439 | } |
436 | } | 440 | } |