From 6ddadd3fa702bd7f4077abeef0a02a10fc381f45 Mon Sep 17 00:00:00 2001 From: Nik Revenco Date: Sat, 12 Jul 2025 14:35:13 +0100 Subject: [PATCH] queries: highlight local closures --- runtime/queries/rust/locals.scm | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/runtime/queries/rust/locals.scm b/runtime/queries/rust/locals.scm index 7958ef04d..6f8e98f04 100644 --- a/runtime/queries/rust/locals.scm +++ b/runtime/queries/rust/locals.scm @@ -21,3 +21,18 @@ ; References (identifier) @local.reference + +; In here, `bar` is a function, as it is equal to a closure: +; +; let bar = || 4; +; +; After this, we know that `bar` must be a function: +; +; let a = bar; +; ^^^ function +; +; let a = f(bar) +; ^^^ function +(let_declaration + pattern: (identifier) @local.definition.function + value: (closure_expression))