File tree 1 file changed +3
-17
lines changed
compiler/rustc_trait_selection/src/traits/error_reporting
1 file changed +3
-17
lines changed Original file line number Diff line number Diff line change @@ -3412,23 +3412,9 @@ fn hint_missing_borrow<'tcx>(
3412
3412
}
3413
3413
} ;
3414
3414
3415
- let fn_decl = match found_node {
3416
- Node :: Expr ( expr) => match & expr. kind {
3417
- hir:: ExprKind :: Closure ( hir:: Closure { fn_decl, .. } ) => fn_decl,
3418
- kind => {
3419
- span_bug ! ( found_span, "expression must be a closure but is {:?}" , kind)
3420
- }
3421
- } ,
3422
- Node :: Item ( item) => match & item. kind {
3423
- hir:: ItemKind :: Fn ( signature, _generics, _body) => signature. decl ,
3424
- kind => {
3425
- span_bug ! ( found_span, "item must be a function but is {:?}" , kind)
3426
- }
3427
- } ,
3428
- node => {
3429
- span_bug ! ( found_span, "node must be a expr or item but is {:?}" , node)
3430
- }
3431
- } ;
3415
+ let fn_decl = found_node
3416
+ . fn_decl ( )
3417
+ . unwrap_or_else ( || span_bug ! ( found_span, "found node must be a function" ) ) ;
3432
3418
3433
3419
let arg_spans = fn_decl. inputs . iter ( ) . map ( |ty| ty. span ) ;
3434
3420
You can’t perform that action at this time.
0 commit comments