diff options
author | Ethan Glasser-Camp <ethan@betacantrips.com> | 2016-11-02 20:01:50 -0400 |
---|---|---|
committer | Ethan Glasser-Camp <ethan@betacantrips.com> | 2016-11-02 20:01:50 -0400 |
commit | 94136d22aae3b92ef66f7673641f7935b76fd98d (patch) | |
tree | 9c5fbe270359e1e8f640603297bb0353a813bc96 | |
parent | 08a34a1eb5b8b21981cde35af1897cc9269e5a8e (diff) |
Reuse Cursor::is_valid()
Thanks @emilio for the suggestion.
-rwxr-xr-x | src/clang.rs | 12 |
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 } } } |