aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-08-19 16:41:56 +0100
committerAleksey Kladov <[email protected]>2020-08-19 16:41:56 +0100
commit11a1bb1c3ec02456813ccb5cb0bdb76f9d39b2ec (patch)
treeface1eb5c4a3cf3817b6cefab96f94663f3b792f
parenta9778c6d73c1ae609d9068a5aeb3e225d8154f59 (diff)
Inline trivial function
-rw-r--r--crates/ide/src/syntax_highlighting.rs14
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
457fn 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
464fn highlight_element( 457fn 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(),