]> git.lizzy.rs Git - rust.git/commitdiff
Minor
authorAleksey Kladov <aleksey.kladov@gmail.com>
Wed, 19 Aug 2020 15:33:25 +0000 (17:33 +0200)
committerAleksey Kladov <aleksey.kladov@gmail.com>
Wed, 19 Aug 2020 15:33:25 +0000 (17:33 +0200)
crates/ide/src/syntax_highlighting.rs

index 549c5efe7cc22ddc526ecf74bb22b52e5a3c80d7..38546ead3ca48b94349064948f2cbfc8cf89106d 100644 (file)
@@ -706,8 +706,7 @@ fn highlight_func_by_name_ref(
     sema: &Semantics<RootDatabase>,
     name_ref: &ast::NameRef,
 ) -> Option<Highlight> {
-    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)
 }