@@ -362,22 +362,22 @@ fn detect_hypot(cx: &LateContext<'_>, args: &[Expr<'_>]) -> Option<String> {
362362 if_chain ! {
363363 if let ExprKind :: MethodCall (
364364 PathSegment { ident: lmethod_name, .. } ,
365- ref _lspan,
366- largs ,
365+ _lspan,
366+ [ largs_0 , largs_1 , .. ] ,
367367 _
368- ) = add_lhs. kind;
368+ ) = & add_lhs. kind;
369369 if let ExprKind :: MethodCall (
370370 PathSegment { ident: rmethod_name, .. } ,
371- ref _rspan,
372- rargs ,
371+ _rspan,
372+ [ rargs_0 , rargs_1 , .. ] ,
373373 _
374- ) = add_rhs. kind;
374+ ) = & add_rhs. kind;
375375 if lmethod_name. as_str( ) == "powi" && rmethod_name. as_str( ) == "powi" ;
376- if let Some ( ( lvalue, _) ) = constant( cx, cx. typeck_results( ) , & largs [ 1 ] ) ;
377- if let Some ( ( rvalue, _) ) = constant( cx, cx. typeck_results( ) , & rargs [ 1 ] ) ;
376+ if let Some ( ( lvalue, _) ) = constant( cx, cx. typeck_results( ) , largs_1 ) ;
377+ if let Some ( ( rvalue, _) ) = constant( cx, cx. typeck_results( ) , rargs_1 ) ;
378378 if Int ( 2 ) == lvalue && Int ( 2 ) == rvalue;
379379 then {
380- return Some ( format!( "{}.hypot({})" , Sugg :: hir( cx, & largs [ 0 ] , ".." ) , Sugg :: hir( cx, & rargs [ 0 ] , ".." ) ) ) ;
380+ return Some ( format!( "{}.hypot({})" , Sugg :: hir( cx, largs_0 , ".." ) , Sugg :: hir( cx, rargs_0 , ".." ) ) ) ;
381381 }
382382 }
383383 }
@@ -407,8 +407,8 @@ fn check_expm1(cx: &LateContext<'_>, expr: &Expr<'_>) {
407407 if cx. typeck_results( ) . expr_ty( lhs) . is_floating_point( ) ;
408408 if let Some ( ( value, _) ) = constant( cx, cx. typeck_results( ) , rhs) ;
409409 if F32 ( 1.0 ) == value || F64 ( 1.0 ) == value;
410- if let ExprKind :: MethodCall ( path, _, method_args , _) = lhs. kind;
411- if cx. typeck_results( ) . expr_ty( & method_args [ 0 ] ) . is_floating_point( ) ;
410+ if let ExprKind :: MethodCall ( path, _, [ self_arg , .. ] , _) = & lhs. kind;
411+ if cx. typeck_results( ) . expr_ty( self_arg ) . is_floating_point( ) ;
412412 if path. ident. name. as_str( ) == "exp" ;
413413 then {
414414 span_lint_and_sugg(
@@ -419,7 +419,7 @@ fn check_expm1(cx: &LateContext<'_>, expr: &Expr<'_>) {
419419 "consider using" ,
420420 format!(
421421 "{}.exp_m1()" ,
422- Sugg :: hir( cx, & method_args [ 0 ] , ".." )
422+ Sugg :: hir( cx, self_arg , ".." )
423423 ) ,
424424 Applicability :: MachineApplicable ,
425425 ) ;
@@ -617,16 +617,16 @@ fn check_log_division(cx: &LateContext<'_>, expr: &Expr<'_>) {
617617 rhs,
618618 ) = & expr. kind;
619619 if are_same_base_logs( cx, lhs, rhs) ;
620- if let ExprKind :: MethodCall ( _, _, largs , _) = lhs. kind;
621- if let ExprKind :: MethodCall ( _, _, rargs , _) = rhs. kind;
620+ if let ExprKind :: MethodCall ( _, _, [ largs_self , .. ] , _) = & lhs. kind;
621+ if let ExprKind :: MethodCall ( _, _, [ rargs_self , .. ] , _) = & rhs. kind;
622622 then {
623623 span_lint_and_sugg(
624624 cx,
625625 SUBOPTIMAL_FLOPS ,
626626 expr. span,
627627 "log base can be expressed more clearly" ,
628628 "consider using" ,
629- format!( "{}.log({})" , Sugg :: hir( cx, & largs [ 0 ] , ".." ) , Sugg :: hir( cx, & rargs [ 0 ] , ".." ) , ) ,
629+ format!( "{}.log({})" , Sugg :: hir( cx, largs_self , ".." ) , Sugg :: hir( cx, rargs_self , ".." ) , ) ,
630630 Applicability :: MachineApplicable ,
631631 ) ;
632632 }
0 commit comments