File tree 1 file changed +9
-8
lines changed
1 file changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -187,7 +187,7 @@ impl Cursor {
187
187
188
188
/// Is the referent a template specialization?
189
189
pub fn is_template ( & self ) -> bool {
190
- self . specialized ( ) . map_or ( false , |c| c . is_valid ( ) )
190
+ self . specialized ( ) . is_some ( )
191
191
}
192
192
193
193
/// Is the referent a fully specialized template specialization without any
@@ -288,14 +288,15 @@ impl Cursor {
288
288
/// Given that this cursor points to a template specialization, get a cursor
289
289
/// pointing to the template definition that is being specialized.
290
290
pub fn specialized ( & self ) -> Option < Cursor > {
291
- if !self . is_valid ( ) {
292
- return None ;
293
- }
294
-
295
291
unsafe {
296
- Some ( Cursor {
297
- x : clang_getSpecializedCursorTemplate ( self . x ) ,
298
- } )
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
+ }
299
300
}
300
301
}
301
302
You can’t perform that action at this time.
0 commit comments