@@ -148,9 +148,10 @@ fn find_class_name(node: &Node, source: &[u8]) -> Option<String> {
148148 return Some ( text. to_string ( ) ) ;
149149 }
150150 for i in 0 ..node. child_count ( ) {
151- let child = node. child ( i) ?;
152- if child. kind ( ) == "class_identifier" {
153- return Some ( extract_identifier_text ( & child, source) ) ;
151+ if let Some ( child) = node. child ( i) {
152+ if child. kind ( ) == "class_identifier" {
153+ return Some ( extract_identifier_text ( & child, source) ) ;
154+ }
154155 }
155156 }
156157 None
@@ -161,12 +162,13 @@ fn find_class_name(node: &Node, source: &[u8]) -> Option<String> {
161162/// `class_identifier > simple_identifier`.
162163fn find_class_superclass ( node : & Node , source : & [ u8 ] ) -> Option < String > {
163164 for i in 0 ..node. child_count ( ) {
164- let child = node. child ( i) ?;
165- if child. kind ( ) == "class_type" {
166- if let Some ( id) = find_child ( & child, "class_identifier" ) {
167- return Some ( extract_identifier_text ( & id, source) ) ;
165+ if let Some ( child) = node. child ( i) {
166+ if child. kind ( ) == "class_type" {
167+ if let Some ( id) = find_child ( & child, "class_identifier" ) {
168+ return Some ( extract_identifier_text ( & id, source) ) ;
169+ }
170+ return Some ( node_text ( & child, source) . trim ( ) . to_string ( ) ) ;
168171 }
169- return Some ( node_text ( & child, source) . trim ( ) . to_string ( ) ) ;
170172 }
171173 }
172174 None
0 commit comments