Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-def/src/expr_store/pretty.rs')
-rw-r--r--crates/hir-def/src/expr_store/pretty.rs43
1 files changed, 5 insertions, 38 deletions
diff --git a/crates/hir-def/src/expr_store/pretty.rs b/crates/hir-def/src/expr_store/pretty.rs
index 1b3a1bb4dc..6a0b1e5197 100644
--- a/crates/hir-def/src/expr_store/pretty.rs
+++ b/crates/hir-def/src/expr_store/pretty.rs
@@ -8,10 +8,9 @@ use span::Edition;
use crate::{
hir::{
Array, BindingAnnotation, CaptureBy, ClosureKind, Literal, LiteralOrConst, Movability,
- Spread, Statement,
+ Statement,
},
pretty::{print_generic_args, print_path, print_type_ref},
- VariantId,
};
use super::*;
@@ -57,32 +56,6 @@ pub(super) fn print_body_hir(
loc.id.item_tree(db)[loc.id.value].name.display(db.upcast(), edition),
)
}
- DefWithBodyId::FieldId(it) => {
- let parent_name: String = match it.parent {
- VariantId::EnumVariantId(it) => {
- let loc = it.lookup(db);
- let enum_loc = loc.parent.lookup(db);
- format!(
- "{}::{}",
- enum_loc.id.item_tree(db)[enum_loc.id.value]
- .name
- .display(db.upcast(), edition),
- loc.id.item_tree(db)[loc.id.value].name.display(db.upcast(), edition),
- )
- }
- VariantId::StructId(it) => it
- .lookup(db)
- .id
- .resolved(db, |it| it.name.display(db.upcast(), edition).to_string()),
- VariantId::UnionId(it) => it
- .lookup(db)
- .id
- .resolved(db, |it| it.name.display(db.upcast(), edition).to_string()),
- };
- let variant_data = it.parent.variant_data(db);
- let field_name = &variant_data.fields()[it.local_id].name;
- format!("field {}.{}", parent_name, field_name.display(db.upcast(), edition),)
- }
};
let mut p = Printer {
@@ -412,16 +385,10 @@ impl Printer<'_> {
p.print_expr(field.expr);
wln!(p, ",");
}
- match spread {
- Spread::No => {}
- Spread::Yes => {
- w!(p, "..");
- }
- Spread::Base(expr) => {
- w!(p, "..");
- p.print_expr(*expr);
- wln!(p);
- }
+ if let Some(spread) = spread {
+ w!(p, "..");
+ p.print_expr(*spread);
+ wln!(p);
}
});
w!(self, "}}");