@@ -437,13 +437,22 @@ fn rewrite_method_call_with_overflow(
437437 context : & RewriteContext ,
438438 shape : Shape ,
439439) -> 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 {
441441 let shape = match shape. shrink_left ( almost_total) {
442442 Some ( b) => b,
443443 None => return false ,
444444 } ;
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+ } ;
445454 let mut last_rewrite = rewrite_method_call (
446- method_name . node ,
455+ segment . identifier ,
447456 types,
448457 expressions,
449458 total_span,
@@ -466,7 +475,7 @@ fn rewrite_method_call_with_overflow(
466475// is a try! macro, we'll convert it to shorthand when the option is set.
467476fn pop_expr_chain ( expr : & ast:: Expr , context : & RewriteContext ) -> Option < ast:: Expr > {
468477 match expr. node {
469- ast:: ExprKind :: MethodCall ( _, _ , ref expressions) => {
478+ ast:: ExprKind :: MethodCall ( _, ref expressions) => {
470479 Some ( convert_try ( & expressions[ 0 ] , context) )
471480 }
472481 ast:: ExprKind :: TupField ( ref subexpr, _) |
@@ -504,8 +513,17 @@ fn rewrite_chain_subexpr(
504513 } ;
505514
506515 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)
509527 }
510528 ast:: ExprKind :: Field ( _, ref field) => rewrite_element ( format ! ( ".{}" , field. node) ) ,
511529 ast:: ExprKind :: TupField ( ref expr, ref field) => {
0 commit comments