diff options
| author | Paul Daniel Faria <nashenas88@users.noreply.github.com> | 2020-06-15 07:19:45 -0400 |
|---|---|---|
| committer | Paul Daniel Faria <Nashenas88@users.noreply.github.com> | 2020-08-10 08:44:54 -0400 |
| commit | fd30134cf84b134259fe8140e513b152e37f3f88 (patch) | |
| tree | dd1570e0399fe25a6d8eb3d0bfdbb1b11c51f50c | |
| parent | 263f9a7f231a474dd56d02adbcd7c57d079e88fd (diff) | |
| download | rust-fd30134cf84b134259fe8140e513b152e37f3f88.tar.gz rust-fd30134cf84b134259fe8140e513b152e37f3f88.zip | |
Remove token tree from ReprKind::Other variant, expose ReprKind higher, remove debug println.
| -rw-r--r-- | crates/ra_hir/src/code_model.rs | 6 | ||||
| -rw-r--r-- | crates/ra_ide/src/syntax_highlighting.rs | 8 |
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 6f9c56d2943..0007d7fa881 100644 --- a/crates/ra_hir/src/code_model.rs +++ b/crates/ra_hir/src/code_model.rs @@ -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, } } diff --git a/crates/ra_ide/src/syntax_highlighting.rs b/crates/ra_ide/src/syntax_highlighting.rs index 0cab684eb47..b82b51efda5 100644 --- a/crates/ra_ide/src/syntax_highlighting.rs +++ b/crates/ra_ide/src/syntax_highlighting.rs @@ -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; } |
