Remove token tree from ReprKind::Other variant, expose ReprKind higher, remove debug println.

This commit is contained in:
Paul Daniel Faria 2020-06-15 07:19:45 -04:00 committed by Paul Daniel Faria
parent 263f9a7f23
commit fd30134cf8
2 changed files with 4 additions and 10 deletions

View file

@ -432,8 +432,8 @@ impl Struct {
Type::from_def(db, self.id.lookup(db.upcast()).container.module(db.upcast()).krate, self.id)
}
pub fn is_packed(self, db: &dyn HirDatabase) -> bool {
matches!(db.struct_data(self.id).repr, Some(ReprKind::Packed))
pub fn repr(self, db: &dyn HirDatabase) -> Option<ReprKind> {
db.struct_data(self.id).repr.clone()
}
fn variant_data(self, db: &dyn HirDatabase) -> Arc<VariantData> {
@ -1266,7 +1266,7 @@ impl Type {
let adt = adt_id.into();
match adt {
Adt::Struct(s) => s.is_packed(db),
Adt::Struct(s) => matches!(s.repr(db), Some(ReprKind::Packed)),
_ => false,
}
}

View file

@ -574,13 +574,7 @@ fn highlight_element(
};
let expr = field_expr.expr()?;
let ty = match sema.type_of_expr(&expr) {
Some(ty) => ty,
None => {
println!("No type :(");
return None;
}
};
let ty = sema.type_of_expr(&expr)?;
if !ty.is_packed(db) {
return None;
}