Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-ty/src/mir/pretty.rs')
-rw-r--r--crates/hir-ty/src/mir/pretty.rs16
1 files changed, 8 insertions, 8 deletions
diff --git a/crates/hir-ty/src/mir/pretty.rs b/crates/hir-ty/src/mir/pretty.rs
index 7ae6e907e7..8764e48b53 100644
--- a/crates/hir-ty/src/mir/pretty.rs
+++ b/crates/hir-ty/src/mir/pretty.rs
@@ -63,16 +63,16 @@ impl MirBody {
}
hir_def::DefWithBodyId::VariantId(id) => {
let loc = id.lookup(db);
- let enum_loc = loc.parent.lookup(db);
+ let edition = this.display_target.edition;
w!(
this,
"enum {}::{} = ",
- enum_loc.id.item_tree(db)[enum_loc.id.value]
- .name
- .display(db, this.display_target.edition),
- loc.id.item_tree(db)[loc.id.value]
- .name
- .display(db, this.display_target.edition),
+ db.enum_signature(loc.parent).name.display(db, edition),
+ loc.parent
+ .enum_variants(db)
+ .variant_name_by_id(id)
+ .unwrap()
+ .display(db, edition),
)
}
});
@@ -336,7 +336,7 @@ impl<'a> MirPrettyCtx<'a> {
w!(
this,
" as {}).{}",
- this.db.enum_variants(loc.parent).variants[loc.index as usize]
+ loc.parent.enum_variants(this.db).variants[loc.index as usize]
.1
.display(this.db, this.display_target.edition),
name.display(this.db, this.display_target.edition)