From 11a1bb1c3ec02456813ccb5cb0bdb76f9d39b2ec Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 19 Aug 2020 17:41:56 +0200 Subject: Inline trivial function --- crates/ide/src/syntax_highlighting.rs | 14 ++++++-------- 1 file 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 { Some(TextRange::new(range_start, range_end)) } -fn is_possibly_unsafe(name_ref: &ast::NameRef) -> bool { - match name_ref.syntax().parent() { - Some(parent) => matches!(parent.kind(), FIELD_EXPR | RECORD_PAT_FIELD), - None => false, - } -} - fn highlight_element( sema: &Semantics, bindings_shadow_count: &mut FxHashMap, @@ -526,7 +519,12 @@ fn highlight_element( binding_hash = Some(calc_binding_hash(&name, *shadow_count)) } }; - let possibly_unsafe = is_possibly_unsafe(&name_ref); + let possibly_unsafe = match name_ref.syntax().parent() { + Some(parent) => { + matches!(parent.kind(), FIELD_EXPR | RECORD_PAT_FIELD) + } + None => false, + }; highlight_def(sema, db, def, Some(name_ref), possibly_unsafe) } NameRefClass::FieldShorthand { .. } => HighlightTag::Field.into(), -- cgit v1.2.3