@@ -175,27 +175,15 @@ impl<'a> FnLikeNode<'a> {
175175 }
176176
177177 pub fn constness ( self ) -> ast:: Constness {
178- match self . kind ( ) {
179- FnKind :: ItemFn ( _, _, header, ..) => header. constness ,
180- FnKind :: Method ( _, m, ..) => m. header . constness ,
181- _ => ast:: Constness :: NotConst
182- }
178+ self . kind ( ) . header ( ) . map_or ( ast:: Constness :: NotConst , |header| header. constness )
183179 }
184180
185181 pub fn asyncness ( self ) -> ast:: IsAsync {
186- match self . kind ( ) {
187- FnKind :: ItemFn ( _, _, header, ..) => header. asyncness ,
188- FnKind :: Method ( _, m, ..) => m. header . asyncness ,
189- _ => ast:: IsAsync :: NotAsync
190- }
182+ self . kind ( ) . header ( ) . map_or ( ast:: IsAsync :: NotAsync , |header| header. asyncness )
191183 }
192184
193185 pub fn unsafety ( self ) -> ast:: Unsafety {
194- match self . kind ( ) {
195- FnKind :: ItemFn ( _, _, header, ..) => header. unsafety ,
196- FnKind :: Method ( _, m, ..) => m. header . unsafety ,
197- _ => ast:: Unsafety :: Normal
198- }
186+ self . kind ( ) . header ( ) . map_or ( ast:: Unsafety :: Normal , |header| header. unsafety )
199187 }
200188
201189 pub fn kind ( self ) -> FnKind < ' a > {
0 commit comments