@@ -175,27 +175,15 @@ impl<'a> FnLikeNode<'a> {
175
175
}
176
176
177
177
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 )
183
179
}
184
180
185
181
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 )
191
183
}
192
184
193
185
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 )
199
187
}
200
188
201
189
pub fn kind ( self ) -> FnKind < ' a > {
0 commit comments