Remove token tree from ReprKind::Other variant, expose ReprKind higher, remove debug println.
This commit is contained in:
committed by
Paul Daniel Faria
parent
263f9a7f23
commit
fd30134cf8
@@ -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,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user