From cd55e94b20d9e2b2f04712cb655c9075aab4e143 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Mon, 27 Feb 2017 19:49:02 +0100 Subject: [PATCH] clang: Avoid a hot FFI call for getting the cursor kind. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is a sorta-hot call already. I've noticed #544 wants to add more assertions about this, and was going to suggest moving them to `debug_assert!`. But there's an easier way :) Signed-off-by: Emilio Cobos Álvarez --- src/clang.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/clang.rs b/src/clang.rs index 1a45eefa06..35dd7cc315 100644 --- a/src/clang.rs +++ b/src/clang.rs @@ -208,7 +208,7 @@ impl Cursor { /// Get the kind of referent this cursor is pointing to. pub fn kind(&self) -> CXCursorKind { - unsafe { clang_getCursorKind(self.x) } + self.x.kind } /// Returns true is the cursor is a definition