diff options
Diffstat (limited to 'crates/ide/src')
-rw-r--r-- | crates/ide/src/syntax_highlighting.rs | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/crates/ide/src/syntax_highlighting.rs b/crates/ide/src/syntax_highlighting.rs index 0a5f7a247..ad49f8e17 100644 --- a/crates/ide/src/syntax_highlighting.rs +++ b/crates/ide/src/syntax_highlighting.rs | |||
@@ -454,13 +454,6 @@ fn macro_call_range(macro_call: &ast::MacroCall) -> Option<TextRange> { | |||
454 | Some(TextRange::new(range_start, range_end)) | 454 | Some(TextRange::new(range_start, range_end)) |
455 | } | 455 | } |
456 | 456 | ||
457 | fn is_possibly_unsafe(name_ref: &ast::NameRef) -> bool { | ||
458 | match name_ref.syntax().parent() { | ||
459 | Some(parent) => matches!(parent.kind(), FIELD_EXPR | RECORD_PAT_FIELD), | ||
460 | None => false, | ||
461 | } | ||
462 | } | ||
463 | |||
464 | fn highlight_element( | 457 | fn highlight_element( |
465 | sema: &Semantics<RootDatabase>, | 458 | sema: &Semantics<RootDatabase>, |
466 | bindings_shadow_count: &mut FxHashMap<Name, u32>, | 459 | bindings_shadow_count: &mut FxHashMap<Name, u32>, |
@@ -526,7 +519,12 @@ fn highlight_element( | |||
526 | binding_hash = Some(calc_binding_hash(&name, *shadow_count)) | 519 | binding_hash = Some(calc_binding_hash(&name, *shadow_count)) |
527 | } | 520 | } |
528 | }; | 521 | }; |
529 | let possibly_unsafe = is_possibly_unsafe(&name_ref); | 522 | let possibly_unsafe = match name_ref.syntax().parent() { |
523 | Some(parent) => { | ||
524 | matches!(parent.kind(), FIELD_EXPR | RECORD_PAT_FIELD) | ||
525 | } | ||
526 | None => false, | ||
527 | }; | ||
530 | highlight_def(sema, db, def, Some(name_ref), possibly_unsafe) | 528 | highlight_def(sema, db, def, Some(name_ref), possibly_unsafe) |
531 | } | 529 | } |
532 | NameRefClass::FieldShorthand { .. } => HighlightTag::Field.into(), | 530 | NameRefClass::FieldShorthand { .. } => HighlightTag::Field.into(), |