aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoroxalica <[email protected]>2021-03-15 17:24:21 +0000
committeroxalica <[email protected]>2021-03-15 17:24:21 +0000
commit73fc05fdca348a899c78f527d08f323cd582100d (patch)
tree17956c67d649f1e7bfa0d67889fda542d47dcb78
parent7c855c940a5fdb5c942ddb3d3401c6e2dbbfca67 (diff)
Pretty print root module of extern crates
-rw-r--r--crates/hir/src/display.rs4
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 }