@@ -437,13 +437,22 @@ fn rewrite_method_call_with_overflow(
437
437
context : & RewriteContext ,
438
438
shape : Shape ,
439
439
) -> bool {
440
- if let & ast:: ExprKind :: MethodCall ( ref method_name , ref types , ref expressions) = expr_kind {
440
+ if let & ast:: ExprKind :: MethodCall ( ref segment , ref expressions) = expr_kind {
441
441
let shape = match shape. shrink_left ( almost_total) {
442
442
Some ( b) => b,
443
443
None => return false ,
444
444
} ;
445
+ let types = match segment. parameters {
446
+ Some ( ref params) => {
447
+ match * * params {
448
+ ast:: PathParameters :: AngleBracketed ( ref data) => & data. types [ ..] ,
449
+ _ => & [ ] ,
450
+ }
451
+ }
452
+ _ => & [ ] ,
453
+ } ;
445
454
let mut last_rewrite = rewrite_method_call (
446
- method_name . node ,
455
+ segment . identifier ,
447
456
types,
448
457
expressions,
449
458
total_span,
@@ -466,7 +475,7 @@ fn rewrite_method_call_with_overflow(
466
475
// is a try! macro, we'll convert it to shorthand when the option is set.
467
476
fn pop_expr_chain ( expr : & ast:: Expr , context : & RewriteContext ) -> Option < ast:: Expr > {
468
477
match expr. node {
469
- ast:: ExprKind :: MethodCall ( _, _ , ref expressions) => {
478
+ ast:: ExprKind :: MethodCall ( _, ref expressions) => {
470
479
Some ( convert_try ( & expressions[ 0 ] , context) )
471
480
}
472
481
ast:: ExprKind :: TupField ( ref subexpr, _) |
@@ -504,8 +513,17 @@ fn rewrite_chain_subexpr(
504
513
} ;
505
514
506
515
match expr. node {
507
- ast:: ExprKind :: MethodCall ( ref method_name, ref types, ref expressions) => {
508
- rewrite_method_call ( method_name. node , types, expressions, span, context, shape)
516
+ ast:: ExprKind :: MethodCall ( ref segment, ref expressions) => {
517
+ let types = match segment. parameters {
518
+ Some ( ref params) => {
519
+ match * * params {
520
+ ast:: PathParameters :: AngleBracketed ( ref data) => & data. types [ ..] ,
521
+ _ => & [ ] ,
522
+ }
523
+ }
524
+ _ => & [ ] ,
525
+ } ;
526
+ rewrite_method_call ( segment. identifier , types, expressions, span, context, shape)
509
527
}
510
528
ast:: ExprKind :: Field ( _, ref field) => rewrite_element ( format ! ( ".{}" , field. node) ) ,
511
529
ast:: ExprKind :: TupField ( ref expr, ref field) => {
0 commit comments