@@ -145,7 +145,7 @@ impl ChainItemKind {
145145
146146 fn from_ast ( context : & RewriteContext < ' _ > , expr : & ast:: Expr ) -> ( ChainItemKind , Span ) {
147147 let ( kind, span) = match expr. kind {
148- ast:: ExprKind :: MethodCall ( ref segment, ref expressions, _) => {
148+ ast:: ExprKind :: MethodCall ( ref segment, ref receiver , ref expressions, _) => {
149149 let types = if let Some ( ref generic_args) = segment. args {
150150 if let ast:: GenericArgs :: AngleBracketed ( ref data) = * * generic_args {
151151 data. args
@@ -163,7 +163,7 @@ impl ChainItemKind {
163163 } else {
164164 vec ! [ ]
165165 } ;
166- let span = mk_sp ( expressions [ 0 ] . span . hi ( ) , expr. span . hi ( ) ) ;
166+ let span = mk_sp ( receiver . span . hi ( ) , expr. span . hi ( ) ) ;
167167 let kind = ChainItemKind :: MethodCall ( segment. clone ( ) , types, expressions. clone ( ) ) ;
168168 ( kind, span)
169169 }
@@ -253,7 +253,7 @@ impl ChainItem {
253253 format ! ( "::<{}>" , type_list. join( ", " ) )
254254 } ;
255255 let callee_str = format ! ( ".{}{}" , rewrite_ident( context, method_name) , type_str) ;
256- rewrite_call ( context, & callee_str, & args[ 1 .. ] , span, shape)
256+ rewrite_call ( context, & callee_str, & args, span, shape)
257257 }
258258}
259259
@@ -400,8 +400,8 @@ impl Chain {
400400 // is a try! macro, we'll convert it to shorthand when the option is set.
401401 fn pop_expr_chain ( expr : & ast:: Expr , context : & RewriteContext < ' _ > ) -> Option < ast:: Expr > {
402402 match expr. kind {
403- ast:: ExprKind :: MethodCall ( _, ref expressions , _) => {
404- Some ( Self :: convert_try ( & expressions [ 0 ] , context) )
403+ ast:: ExprKind :: MethodCall ( _, ref receiver , _ , _) => {
404+ Some ( Self :: convert_try ( & receiver , context) )
405405 }
406406 ast:: ExprKind :: Field ( ref subexpr, _)
407407 | ast:: ExprKind :: Try ( ref subexpr)
0 commit comments