aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_hir/src/code_model.rs6
-rw-r--r--crates/ra_ide/src/syntax_highlighting.rs8
2 files changed, 4 insertions, 10 deletions
diff --git a/crates/ra_hir/src/code_model.rs b/crates/ra_hir/src/code_model.rs
index 6f9c56d29..0007d7fa8 100644
--- a/crates/ra_hir/src/code_model.rs
+++ b/crates/ra_hir/src/code_model.rs
@@ -432,8 +432,8 @@ impl Struct {
432 Type::from_def(db, self.id.lookup(db.upcast()).container.module(db.upcast()).krate, self.id) 432 Type::from_def(db, self.id.lookup(db.upcast()).container.module(db.upcast()).krate, self.id)
433 } 433 }
434 434
435 pub fn is_packed(self, db: &dyn HirDatabase) -> bool { 435 pub fn repr(self, db: &dyn HirDatabase) -> Option<ReprKind> {
436 matches!(db.struct_data(self.id).repr, Some(ReprKind::Packed)) 436 db.struct_data(self.id).repr.clone()
437 } 437 }
438 438
439 fn variant_data(self, db: &dyn HirDatabase) -> Arc<VariantData> { 439 fn variant_data(self, db: &dyn HirDatabase) -> Arc<VariantData> {
@@ -1266,7 +1266,7 @@ impl Type {
1266 1266
1267 let adt = adt_id.into(); 1267 let adt = adt_id.into();
1268 match adt { 1268 match adt {
1269 Adt::Struct(s) => s.is_packed(db), 1269 Adt::Struct(s) => matches!(s.repr(db), Some(ReprKind::Packed)),
1270 _ => false, 1270 _ => false,
1271 } 1271 }
1272 } 1272 }
diff --git a/crates/ra_ide/src/syntax_highlighting.rs b/crates/ra_ide/src/syntax_highlighting.rs
index 0cab684eb..b82b51efd 100644
--- a/crates/ra_ide/src/syntax_highlighting.rs
+++ b/crates/ra_ide/src/syntax_highlighting.rs
@@ -574,13 +574,7 @@ fn highlight_element(
574 }; 574 };
575 575
576 let expr = field_expr.expr()?; 576 let expr = field_expr.expr()?;
577 let ty = match sema.type_of_expr(&expr) { 577 let ty = sema.type_of_expr(&expr)?;
578 Some(ty) => ty,
579 None => {
580 println!("No type :(");
581 return None;
582 }
583 };
584 if !ty.is_packed(db) { 578 if !ty.is_packed(db) {
585 return None; 579 return None;
586 } 580 }