@@ -13,7 +13,7 @@ use rustc_hir as hir;
13
13
use rustc_hir:: def:: DefKind ;
14
14
use rustc_hir:: def_id:: DefId ;
15
15
use rustc_hir:: lang_items:: LangItem ;
16
- use rustc_hir:: { Expr , ExprKind , Node , QPath } ;
16
+ use rustc_hir:: { ExprKind , Node , QPath } ;
17
17
use rustc_infer:: infer:: {
18
18
type_variable:: { TypeVariableOrigin , TypeVariableOriginKind } ,
19
19
RegionVariableOrigin ,
@@ -475,29 +475,30 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
475
475
let mut applicability = Applicability :: MachineApplicable ;
476
476
let args = if let Some ( ( receiver, args) ) = args {
477
477
// The first arg is the same kind as the receiver
478
- let it = if first_arg. is_some ( ) {
479
- Box :: new ( std:: iter:: once ( receiver) . chain ( args. iter ( ) ) )
480
- as Box < dyn Iterator < Item = & Expr < ' _ > > >
478
+ let explicit_args = if first_arg. is_some ( ) {
479
+ std:: iter:: once ( receiver) . chain ( args. iter ( ) ) . collect :: < Vec < _ > > ( )
481
480
} else {
482
481
// There is no `Self` kind to infer the arguments from
483
482
if has_unsuggestable_args {
484
483
applicability = Applicability :: HasPlaceholders ;
485
484
}
486
- Box :: new ( args. iter ( ) ) as _
485
+ args. iter ( ) . collect ( )
487
486
} ;
488
487
format ! (
489
488
"({}{})" ,
490
489
first_arg. unwrap_or( "" ) ,
491
- it. map( |arg| tcx
492
- . sess
493
- . source_map( )
494
- . span_to_snippet( arg. span)
495
- . unwrap_or_else( |_| {
496
- applicability = Applicability :: HasPlaceholders ;
497
- "_" . to_owned( )
498
- } ) )
499
- . collect:: <Vec <_>>( )
500
- . join( ", " ) ,
490
+ explicit_args
491
+ . iter( )
492
+ . map( |arg| tcx
493
+ . sess
494
+ . source_map( )
495
+ . span_to_snippet( arg. span)
496
+ . unwrap_or_else( |_| {
497
+ applicability = Applicability :: HasPlaceholders ;
498
+ "_" . to_owned( )
499
+ } ) )
500
+ . collect:: <Vec <_>>( )
501
+ . join( ", " ) ,
501
502
)
502
503
} else {
503
504
applicability = Applicability :: HasPlaceholders ;
0 commit comments