mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-13 21:54:42 +00:00
Remove token tree from ReprKind::Other variant, expose ReprKind higher, remove debug println.
This commit is contained in:
parent
263f9a7f23
commit
fd30134cf8
2 changed files with 4 additions and 10 deletions
|
@ -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,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue