File tree Expand file tree Collapse file tree 1 file changed +3
-17
lines changed
compiler/rustc_trait_selection/src/traits/error_reporting Expand file tree Collapse file tree 1 file changed +3
-17
lines changed Original file line number Diff line number Diff line change @@ -3065,23 +3065,9 @@ fn hint_missing_borrow<'tcx>(
30653065 }
30663066 } ;
30673067
3068- let fn_decl = match found_node {
3069- Node :: Expr ( expr) => match & expr. kind {
3070- hir:: ExprKind :: Closure ( hir:: Closure { fn_decl, .. } ) => fn_decl,
3071- kind => {
3072- span_bug ! ( found_span, "expression must be a closure but is {:?}" , kind)
3073- }
3074- } ,
3075- Node :: Item ( item) => match & item. kind {
3076- hir:: ItemKind :: Fn ( signature, _generics, _body) => signature. decl ,
3077- kind => {
3078- span_bug ! ( found_span, "item must be a function but is {:?}" , kind)
3079- }
3080- } ,
3081- node => {
3082- span_bug ! ( found_span, "node must be a expr or item but is {:?}" , node)
3083- }
3084- } ;
3068+ let fn_decl = found_node
3069+ . fn_decl ( )
3070+ . unwrap_or_else ( || span_bug ! ( found_span, "found node must be a function" ) ) ;
30853071
30863072 let arg_spans = fn_decl. inputs . iter ( ) . map ( |ty| ty. span ) ;
30873073
You can’t perform that action at this time.
0 commit comments