@@ -111,7 +111,7 @@ fn find_bool_node(ctx: &AssistContext<'_>) -> Option<BoolNodeData> {
111111 initializer : let_stmt. initializer ( ) ,
112112 definition : Definition :: Local ( def) ,
113113 } )
114- } else if let Some ( const_) = name. syntax ( ) . ancestors ( ) . find_map ( ast:: Const :: cast) {
114+ } else if let Some ( const_) = name. syntax ( ) . parent ( ) . and_then ( ast:: Const :: cast) {
115115 let def = ctx. sema . to_def ( & const_) ?;
116116 if !def. ty ( ctx. db ( ) ) . is_bool ( ) {
117117 cov_mark:: hit!( not_applicable_non_bool_const) ;
@@ -125,7 +125,7 @@ fn find_bool_node(ctx: &AssistContext<'_>) -> Option<BoolNodeData> {
125125 initializer : const_. body ( ) ,
126126 definition : Definition :: Const ( def) ,
127127 } )
128- } else if let Some ( static_) = name. syntax ( ) . ancestors ( ) . find_map ( ast:: Static :: cast) {
128+ } else if let Some ( static_) = name. syntax ( ) . parent ( ) . and_then ( ast:: Static :: cast) {
129129 let def = ctx. sema . to_def ( & static_) ?;
130130 if !def. ty ( ctx. db ( ) ) . is_bool ( ) {
131131 cov_mark:: hit!( not_applicable_non_bool_static) ;
@@ -140,7 +140,7 @@ fn find_bool_node(ctx: &AssistContext<'_>) -> Option<BoolNodeData> {
140140 definition : Definition :: Static ( def) ,
141141 } )
142142 } else {
143- let field = name. syntax ( ) . ancestors ( ) . find_map ( ast:: RecordField :: cast) ?;
143+ let field = name. syntax ( ) . parent ( ) . and_then ( ast:: RecordField :: cast) ?;
144144 if field. name ( ) ? != name {
145145 return None ;
146146 }
0 commit comments