summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEthan Glasser-Camp <ethan@betacantrips.com>2016-11-02 20:01:50 -0400
committerEthan Glasser-Camp <ethan@betacantrips.com>2016-11-02 20:01:50 -0400
commit94136d22aae3b92ef66f7673641f7935b76fd98d (patch)
tree9c5fbe270359e1e8f640603297bb0353a813bc96
parent08a34a1eb5b8b21981cde35af1897cc9269e5a8e (diff)
Reuse Cursor::is_valid()
Thanks @emilio for the suggestion.
-rwxr-xr-xsrc/clang.rs12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/clang.rs b/src/clang.rs
index 3f23cbb6..f8aac1c1 100755
--- a/src/clang.rs
+++ b/src/clang.rs
@@ -289,14 +289,10 @@ impl Cursor {
/// pointing to the template definition that is being specialized.
pub fn specialized(&self) -> Option<Cursor> {
unsafe {
- let clang_specialized = clang_getSpecializedCursorTemplate(self.x);
- if clang_isInvalid(clang_getCursorKind(clang_specialized)) == 0 {
- Some(Cursor {
- x: clang_specialized,
- })
- } else {
- None
- }
+ let ret = Cursor {
+ x: clang_getSpecializedCursorTemplate(self.x)
+ };
+ if ret.is_valid() { Some(ret) } else { None }
}
}