@@ -335,9 +335,9 @@ def is_in_system_header(self):
335335 return conf .lib .clang_Location_isInSystemHeader (self ) # type: ignore [no-any-return]
336336
337337 def __eq__ (self , other ):
338- if not isinstance (other , SourceLocation ):
339- return False
340- return conf . lib . clang_equalLocations ( self , other ) # type: ignore [no-any-return]
338+ return isinstance (other , SourceLocation ) and conf . lib . clang_equalLocations (
339+ self , other
340+ )
341341
342342 def __ne__ (self , other ):
343343 return not self .__eq__ (other )
@@ -395,9 +395,9 @@ def end(self):
395395 return conf .lib .clang_getRangeEnd (self ) # type: ignore [no-any-return]
396396
397397 def __eq__ (self , other ):
398- if not isinstance (other , SourceRange ):
399- return False
400- return conf . lib . clang_equalRanges ( self , other ) # type: ignore [no-any-return]
398+ return isinstance (other , SourceRange ) and conf . lib . clang_equalRanges (
399+ self , other
400+ )
401401
402402 def __ne__ (self , other ):
403403 return not self .__eq__ (other )
@@ -1599,9 +1599,7 @@ def from_location(tu: TranslationUnit, location: SourceLocation) -> Cursor | Non
15991599
16001600 # This function is not null-guarded because it is used in cursor_null_guard itself
16011601 def __eq__ (self , other : object ) -> bool :
1602- if not isinstance (other , Cursor ):
1603- return False
1604- return conf .lib .clang_equalCursors (self , other ) # type: ignore [no-any-return]
1602+ return isinstance (other , Cursor ) and conf .lib .clang_equalCursors (self , other )
16051603
16061604 # Not null-guarded for consistency with __eq__
16071605 def __ne__ (self , other : object ) -> bool :
0 commit comments