Skip to content

Commit 94136d2

Browse files
committed
Reuse Cursor::is_valid()
Thanks @emilio for the suggestion.
1 parent 08a34a1 commit 94136d2

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

src/clang.rs

+4-8
Original file line numberDiff line numberDiff line change
@@ -289,14 +289,10 @@ impl Cursor {
289289
/// pointing to the template definition that is being specialized.
290290
pub fn specialized(&self) -> Option<Cursor> {
291291
unsafe {
292-
let clang_specialized = clang_getSpecializedCursorTemplate(self.x);
293-
if clang_isInvalid(clang_getCursorKind(clang_specialized)) == 0 {
294-
Some(Cursor {
295-
x: clang_specialized,
296-
})
297-
} else {
298-
None
299-
}
292+
let ret = Cursor {
293+
x: clang_getSpecializedCursorTemplate(self.x)
294+
};
295+
if ret.is_valid() { Some(ret) } else { None }
300296
}
301297
}
302298

0 commit comments

Comments
 (0)