From 0b62b990ba69efd23f26218d0461a2cef15e593a Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 19 Aug 2020 17:33:25 +0200 Subject: [PATCH] Minor --- crates/ide/src/syntax_highlighting.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/crates/ide/src/syntax_highlighting.rs b/crates/ide/src/syntax_highlighting.rs index 549c5efe7cc..38546ead3ca 100644 --- a/crates/ide/src/syntax_highlighting.rs +++ b/crates/ide/src/syntax_highlighting.rs @@ -706,8 +706,7 @@ fn highlight_func_by_name_ref( sema: &Semantics, name_ref: &ast::NameRef, ) -> Option { - let parent = name_ref.syntax().parent()?; - let method_call = ast::MethodCallExpr::cast(parent)?; + let method_call = name_ref.syntax().parent().and_then(ast::MethodCallExpr::cast)?; highlight_method_call(sema, &method_call) }