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) 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 { pub fn repr(self, db: &dyn HirDatabase) -> Option<ReprKind> {
matches!(db.struct_data(self.id).repr, Some(ReprKind::Packed)) db.struct_data(self.id).repr.clone()
} }
fn variant_data(self, db: &dyn HirDatabase) -> Arc<VariantData> { fn variant_data(self, db: &dyn HirDatabase) -> Arc<VariantData> {
@@ -1266,7 +1266,7 @@ impl Type {
let adt = adt_id.into(); let adt = adt_id.into();
match adt { match adt {
Adt::Struct(s) => s.is_packed(db), Adt::Struct(s) => matches!(s.repr(db), Some(ReprKind::Packed)),
_ => false, _ => false,
} }
} }

View File

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